define(".", [ "static_v4/js/minJS/commonPlug/commonPlug.min", "static_v4/js/plug/swiper/swiper3.4.min", "static_v4/js/mod/swiperAds", "static_v4/js/mod/visualAreaInfo", "static_v4/js/mod/myOrderSearch_sea", "static_v4/js/mod/public", "static_v4/js/mod/myOrder_sea", "static_v4/js/mod/submit_pay", "static_v4/js/mod/baiduCount" ], function(require, exports, module) {
    require("static_v4/js/minJS/commonPlug/commonPlug.min");
    require("static_v4/js/plug/swiper/swiper3.4.min");
    /*2018年4月13日--lou-添加*/
    require("static_v4/js/mod/swiperAds");
    /*2019.08.22添加搜索需求*/
    require("static_v4/js/mod/myOrderSearch_sea");
    var OIndexSea = require("static_v4/js/mod/myOrder_sea");
    module.exports = {
        init: function(names, counts) {
            OIndexSea.init(names, counts);
        }
    };
    require("static_v4/js/mod/baiduCount");
});
define("static_v4/js/mod/myOrder_sea", [ "./public", "./submit_pay" ], function(require, exports, module) {
    var myPub = require("./public");
    var payPub = require("./submit_pay");
    var oWindow = $(window);
    var oSildeNavUl = $(".js_sildeNavUl");
    // 导航滚动条ul
    var oOrderSw = $(".js_swiper");
    var oHeader = $(".js_headerBox");
    // 头部
    var oContain = $(".orderContain");
    var oSlidePageWrap = $(".js_slidePageWrap");
    // 滑动页面
    var oOrderBtnEvent = $(".js_orderBtnEvent");
    // 操作订单下方按钮
    var oSlidePageScroll = $(".js_slidePageScroll");
    // 导航滚动条容器
    var oGoTop = $(".js_goTop");
    // 回到顶部
    var oSildeNavScroll = $(".js_sildeNavScroll");
    // 导航滚动条容器
    var oSideBox = $(".js_sideBox");
    // 侧边按钮框
    var oLoadingPage = $(".js_loadingPage");
    var nDisScrollLi = 0;
    // 导航滚动偏移值
    var resizeTimer = null;
    var lazLoading = new myPub.lazLoadingImg();
    // 全局 订单类型
    var sign = [ "all", "wait4Payment", "wait4Delivery", "wait4Receive", "tradeSuccess" ];
    // 获取数据路径
    var orderUrl = "/member/order/showTypePaymentV4";
    var orderUrl2 = "static_v4/js/dataJson/goodsData.json";
    var storeDetailUrl = "/m/g/supplier/1.0/isOverSeaSupplier";
    // 判断是进入海外店铺还是进入普通店铺的接口
    // 回到过顶部
    oGoTop.hammer().on("tap", function() {
        var oSlidePageScroll = $(".js_slidePageScroll");
        oSlidePageScroll.eq(pageData.navIndex).stop().animate({
            scrollTop: "0"
        }, 250);
        oHeader.css({
            top: 0
        }).find(".js_sildeNav").removeClass("active");
        myPub.HamstopPropaga();
    });
    //按钮的点击事件绑定给最大的wrap盒子
    oOrderBtnEvent.hammer().on("tap", function(e) {
        var _btnA = $(e.gesture.target);
        var _typeNum = _btnA.attr("_type");
        var oId = _btnA.attr("oId");
        var orderSn = _btnA.attr("_orderSn");
        var imgUrl = _btnA.parents(".onOrderFoot").siblings(".goods_showChangeBox").find(".js_lazyImg").attr("src");
        if (_typeNum !== undefined) {
            myPub.HamstopPropaga();
        }
        switch (_typeNum * 1) {
          // 0 删除订单
            case 0:
            myPub.askLayer("确认要删除订单吗？ ", function() {
                //    确认的回调
                G_JSON_GET("/member/order/delete", {
                    orderId: oId
                }, function(data) {
                    if (data.status == "success") {
                        location.reload();
                    } else {
                        myPub.TipLayer(data.message);
                    }
                });
                myPub.LayerCloseAll();
            }, function() {}, null, function() {});
            break;

          // 1 提醒发货
            case 1:
            var styleTitle = "提醒发货成功!请耐心等候";
            var remindStyle = "background-color:rgba(0,0,0,0.5); color:#fff; border:none; border-radius: 5px; min-width:50%";
            myPub.TipLayer(styleTitle, remindStyle);
            break;

          // 2.查看物流
            case 2:
            //跳转到查看物流页面
            window.location.href = "/h/goodsafter/expressDetail/" + orderSn;
            break;

          // 3 确认收货
            case 3:
            myPub.askLayer("确认要收货吗？ ", function() {
                //    确认的回调
                G_JSON_GET("/member/order/receive", {
                    orderId: oId
                }, function(data) {
                    if (data.status == "success") {
                        //location.reload();
                        // window.location.href = '/shop/goodsComment/comment/'+oId;
                        window.location.href = "/h/goodsafter/applyAppraisal/" + oId + "?picImgUrl=" + imgUrl;
                    } else {
                        myPub.TipLayer(data.message);
                    }
                });
                myPub.LayerCloseAll();
            }, function() {}, null, function() {});
            break;

          // 4 立即评价
            case 4:
            // window.location.href= "/shop/goodsComment/comment/"+oId;
            window.location.href = "/h/goodsafter/applyAppraisal/" + oId + "?picImgUrl=" + imgUrl;
            // G_JSON_GET('/shop/goodsComment/find_comment/'+oId+'?receiveDate='+_btnA.attr('receiveDate'), null, function (data) {
            //     if (data.status == "first") {
            //     }else if (data.status == "append") {
            //         window.location.href= "/shop/goodsComment/appendComment/"+oId;
            //     } else {
            //         myPub.TipLayer(data.message);
            //     }
            // });
            break;

          // 5 去支付
            case 5:
            var payUrl = "/shop/payment/continuePay";
            var data = {
                paymentId: oId
            };
            payPub.submitPay(payUrl, data);
            break;

          // 6 取消订单
            case 6:
            myPub.askLayer("确认要取消订单吗？ ", function() {
                G_JSON_POST("/shop/payment/cancelNoPayOrder", {
                    paymentId: oId
                }, function(data) {
                    if (data.status == "success") {
                        location.reload();
                    } else {
                        myPub.TipLayerEnd(data.message, "no", function() {
                            location.reload();
                        });
                    }
                });
                myPub.LayerCloseAll();
            }, function() {}, null, function() {});
            break;

          // 7 分享给TA
            case 7:
            window.location.href = "/shop/gift/sharePage/" + oId;
            break;

          //8 追加评论
            case 8:
            window.location.href = "/shop/goodsComment/appendComment/" + oId;
            break;

          case 9:
            window.location.href = "/super/distributorDownLoad";
            break;

          default:
            break;
        }
    });
    module.exports = {
        init: function(names, counts) {
            pageData.initHistoryData(names.length);
            myOrderSwiper.initOrderSwiper(names, counts);
            myOrderSwiper.myOrderInit(true);
            myOrderSwiper.ScrollPage();
            // 页面尺寸修改
            oWindow.on("resize", function() {
                if (resizeTimer) {
                    clearTimeout(resizeTimer);
                }
                resizeTimer = setTimeout(function() {
                    myOrderSwiper.myOrderInit(true);
                }, 400);
            });
            // 初始化 分页位置或者数据
            if (pageData.navIndex != 0) {
                myOrderSwiper.oSlidePageMain.slideTo(pageData.navIndex, 100);
            } else {
                pageData.swiperLoadData(0);
            }
            oWindow.unload(function() {
                pageData.storeSession();
            });
        }
    };
    var pageData = {
        navIndex: 0,
        // 导航选中索引  需要放入Session
        pagearr: [ 1 ],
        // 每个分页的翻页数  需要放入Session
        pageSCroll: [ 0 ],
        // 每个分页滚动高度  需要放入Session
        loadPage: [ 0 ],
        // 每个分页已经加载的页码
        pageFinish: [ false ],
        // 每个分页是否加载完成
        swiperScroll: [ 0 ],
        pageLimit: 20,
        /**
         * 初始化方法 从Session中加载数据 没有就初始化
         * @param initNav 需要直接定位的分页标签
         */
        initHistoryData: function(navLength) {
            var _this = this;
            var _LocalIndex = 0;
            for (var i = 0; i < navLength; i++) {
                _this.pagearr[i] = 1;
                _this.pageSCroll[i] = 0;
                _this.loadPage[i] = 0;
                _this.pageFinish[i] = false;
                _this.swiperScroll[i] = 0;
            }
            var sessionNavIndex = sessionStorage.getItem("order_navIndex");
            sessionNavIndex || sessionNavIndex != null ? parseInt(sessionNavIndex) : sessionNavIndex = _LocalIndex;
            _this.navIndex = sessionNavIndex;
            // _this.showDebugData();
            var localNavIndex = localStorage.getItem("orderNav_index");
            if (localNavIndex != null) {
                switch (localNavIndex) {
                  case "dzf":
                    _LocalIndex = 1;
                    break;

                  case "dfh":
                    _LocalIndex = 2;
                    break;

                  case "dsh":
                    _LocalIndex = 3;
                    break;

                  case "jycg":
                    _LocalIndex = 4;
                    break;

                  case "0":
                    _LocalIndex = 0;
                    break;

                  default:
                    _LocalIndex = 10;
                }
                _this.navIndex = _LocalIndex;
                if (_LocalIndex == 10) {
                    if (sessionNavIndex && sessionNavIndex != null) {
                        _this.navIndex = parseInt(sessionNavIndex);
                    } else {
                        _this.navIndex = 0;
                    }
                }
                localStorage.removeItem("orderNav_index");
            }
            var sessionPagearr = sessionStorage.getItem("order_pagearr");
            if (sessionPagearr != null) {
                var pagearrNum = sessionPagearr.split(",");
                for (var i = 0; i < pagearrNum.length; i++) {
                    _this.pagearr[i] = parseInt(pagearrNum[i]);
                }
            }
            var sessionPageSCroll = sessionStorage.getItem("order_pageSCroll");
            if (sessionPageSCroll != null) {
                var pageSCrollNum = sessionPageSCroll.split(",");
                for (var i = 0; i < pageSCrollNum.length; i++) {
                    _this.pageSCroll[i] = parseInt(pageSCrollNum[i]);
                }
            }
            _this.storeSession();
        },
        /**
         * 保存数据到Session中
         */
        storeSession: function() {
            var _this = this;
            // _this.showDebugData();
            sessionStorage.setItem("order_navIndex", _this.navIndex);
            sessionStorage.setItem("order_pagearr", _this.pagearr);
            sessionStorage.setItem("order_pageSCroll", _this.pageSCroll);
        },
        /**
         * 滑动加载数据方法
         */
        swiperLoadData: function(index) {
            var _this = this;
            // _this.showDebugData();
            _this.initHistoryData();
            _this.navIndex = index;
            if (_this.pageFinish[index] || _this.loadPage[index] > 0) {
                var oSlidePageScroll = $(".js_slidePageScroll");
                // console.log("scroll  %o  index  %o  oSlidePageScroll  %o",_this.pageSCroll[index],index,oSlidePageScroll);
                oSlidePageScroll.eq(index).scrollTop(_this.pageSCroll[index]);
                return;
            }
            _this.lockScrollHeight(index);
            _this.asynGetOrderData(index, 0, _this.pagearr[index], function() {
                // _this.showDebugData();
                _this.swiperScrollHeight(index);
            });
        },
        /**
         * 滚动下拉加载数据方法
         */
        scrollLoadData: function(index) {
            var _this = this;
            // _this.showDebugData();
            if (_this.pageFinish[index]) {
                return;
            }
            _this.asynGetOrderData(index, _this.loadPage[index], 1, function() {
                _this.pagearr[index]++;
            });
            _this.storeSession();
        },
        /**
         * 异步请求订单数据
         * @param startPage 从第几页开始加载
         * @param page 加载几页数据
         */
        asynGetOrderData: function(index, startPage, page, fn) {
            var _this = this;
            var type = sign[index];
            var pageLimit = 20;
            var start = startPage * _this.pageLimit;
            var limit = page * _this.pageLimit;
            G_JSON_POST(orderUrl, {
                type: type,
                start: start,
                limit: limit
            }, function(data) {
                if (data.status == "success") {
                    var dataOrderList = data.orderList;
                    var dataSupplierMap = data.supplierMap;
                    orderHtml.oneOrderHtml(index, dataOrderList, dataSupplierMap);
                    if (dataOrderList.length <= 0) {
                        //当请求的数据为0时，表示已经没有数据了，不能用limit来判断，有可能是通过paymentOrderId来判断的，数据会大于或者小于limit
                        _this.pageFinish[index] = true;
                    }
                    if (dataOrderList.length > 0) {
                        //  page++;
                        //  console.log(page)
                        //  _this.pagearr[index] += page;
                        // _this.pagearr[index] += page;
                        if (fn) fn();
                    }
                    // if (fn) fn();
                    data = null;
                    dataOrderList = null;
                } else {
                    if (fn) fn();
                }
            }, function() {
                oLoadingPage.show();
            }, function(data) {
                var oSlidePageScroll = $(".js_slidePageScroll");
                if (data.length == 0 && start == 0) {
                    oSlidePageScroll.eq(index).find(".js_transaction").append(orderHtml.noOrderPage());
                }
                _this.loadPage[index] = _this.pagearr[index];
                oLoadingPage.hide();
                if (data.orderList) {
                    if (data.orderList.length < _this.pageLimit) {
                        _this.pageFinish[index] = true;
                    }
                } else if (data.length == 0) {
                    _this.pageFinish[index] = true;
                }
            });
        },
        /**
         * 锁定一下高度切换
         */
        lockScrollHeight: function(index) {
            var _this = this;
            _this.swiperScroll[index] += 1;
        },
        /**
         * 切换标签或数据加载完成后 滚动到指定的高度
         */
        swiperScrollHeight: function(index) {
            var _this = this;
            _this.swiperScroll[index] -= 1;
            // console.log("swiperScrollHeight %o",_this.swiperScroll[index]);
            if (_this.swiperScroll[index] == 0) {
                var oSlidePageScroll = $(".js_slidePageScroll");
                oSlidePageScroll.eq(index).scrollTop(_this.pageSCroll[index]);
            }
        },
        showDebugData: function() {
            console.log("navIndex == %o", pageData.navIndex);
            console.log("pagearr == %o", pageData.pagearr);
            console.log("pageSCroll == %o", pageData.pageSCroll);
            console.log("loadPage == %o", pageData.loadPage);
            console.log("pageFinish == %o", pageData.pageFinish);
            console.log("pageFinish == %o", pageData.swiperScroll);
        },
        // 判断是进入海外店铺还是进入普通店铺的接口
        goToStoreDetail: function(supplierId) {
            var _this = this;
            G_JSON_POST(storeDetailUrl, {
                supplierId: supplierId
            }, function(data) {
                var _data = data.data;
                var _ret = data.ret;
                // console.log('data',_data,_ret);
                if (_ret.code == "0") {
                    if (_data) {
                        // 海外馆商家
                        window.location.href = BASE_URL + "/h/store/storehome?supplierId=" + supplierId;
                    } else {
                        // 普通商家
                        window.location.href = BASE_URL + "/h/store/normalStore/" + supplierId;
                    }
                } else {
                    // 如果请求不到就跳转普通商家
                    window.location.href = BASE_URL + "/h/store/normalStore/" + supplierId;
                }
            });
        }
    };
    //我的订单的各个方法
    var myOrderSwiper = {
        oSlidePageMain: "",
        nHeaderHeight: 0,
        //
        time_Scroll: null,
        // 滚动计时器
        initOrderSwiper: function(names, counts) {
            var $this = this;
            // 插入slide
            for (var i = 0; i < names.length; i++) {
                oSlidePageWrap.append('<div class="swiper-slide js_slidePageScroll"><section class="myOrderAll"><div class="transaction js_transaction"></div></section></div>');
            }
            $this.oSlidePageMain = oOrderSw.swiper({
                pagination: oSildeNavUl[0],
                // autoHeight: true, //高度随内容变化
                observe: true,
                observeParents: true,
                // threshold:100,
                touchAngle: 20,
                paginationClickable: true,
                paginationBulletRender: function(swipe, index, className) {
                    //添加导航
                    if (counts[index] > 0) {
                        return '<li class="' + className + ' Bflex1"><a>' + names[index] + '</a><i class="record js_showNum">' + counts[index] + "</i></li>";
                    } else {
                        return '<li class="' + className + ' Bflex1"><a>' + names[index] + "</a></li>";
                    }
                },
                onSlideChangeStart: function(swiper) {
                    var index = swiper.activeIndex;
                    $this.oSlidePageMain.detachEvents();
                    pageData.lockScrollHeight(index);
                    // 请求加载广告
                    pageData.swiperLoadData(index);
                },
                onSlideChangeEnd: function(swiper) {
                    var oSlidePageScroll = $(".js_slidePageScroll");
                    var index = swiper.activeIndex;
                    oSlidePageScroll.find(".myOrderAll").hide().eq(index).show();
                    myOrderSwiper.myOrderInit(false);
                    //
                    lazLoading.DestroyLazLoadingImg();
                    lazLoading.AddLazLoadingImg(oSlidePageScroll[index]);
                    pageData.storeSession();
                    $this.oSlidePageMain.attachEvents();
                    pageData.swiperScrollHeight(index);
                }
            });
        },
        myOrderInit: function(bOff) {
            var oSlidePageScroll = $(".js_slidePageScroll");
            if (bOff) {
                oContain.css({
                    "padding-top": 0
                });
                oSlidePageScroll.css({
                    height: oWindow.height() - oHeader.height(),
                    "padding-top": oHeader.outerHeight(true)
                });
            }
            oSideBox.stop().animate({
                right: "-3.5rem"
            }, 300);
        },
        // 滚动隐藏搜索
        ScrollPage: function() {
            var _this = this;
            var oSlidePageScroll = $(".js_slidePageScroll");
            var minScrHeight = 300;
            _this.nHeaderHeight = parseInt(oHeader.outerHeight(true));
            oSlidePageScroll.off("scroll");
            oSlidePageScroll.on("scroll", function() {
                var afterScroll = $(this).scrollTop();
                // 滚动页面距离底部300像素 延迟150毫秒加载数据
                clearTimeout(_this.time_Scroll);
                _this.time_Scroll = setTimeout(function() {
                    var index = pageData.navIndex;
                    // 设置缓存记录
                    pageData.pageSCroll[index] = afterScroll;
                    pageData.storeSession();
                    // 显示隐藏回到顶部侧边框
                    _this.ShowGoTop(afterScroll);
                    if (oSlidePageScroll[index].scrollHeight - afterScroll - oSlidePageScroll.height() < minScrHeight) {
                        // 设置翻页到最后一页 返回
                        if (pageData.pageFinish[index]) {
                            oSlidePageScroll.eq(index).find(".js_loadingBtn").hide().eq(0).show();
                            return;
                        }
                        pageData.scrollLoadData(index);
                    }
                }, 150);
            });
        },
        // 显示回到顶部按钮
        ShowGoTop: function(scrollTop) {
            scrollTop > 300 ? oSideBox.stop().animate({
                right: 0
            }, 300) : oSideBox.stop().animate({
                right: "-3.5rem"
            }, 300);
        },
        // 点击进入店铺详情页面要判断是否是海外店铺
        goToStoreEvent: function() {
            $(".js_goToStore").on("click", function() {
                var supplierId = $(this).attr("data-supplierId");
                pageData.goToStoreDetail(supplierId);
            });
        }
    };
    //拼接的html
    var orderHtml = {
        oneOrderHtml: function(iNow, dataOrderList, dataSupplierMap) {
            var _this = this;
            var oSlidePageScroll = $(".js_slidePageScroll");
            var shtmlBox = "";
            var orderArray = [];
            var orderMap = {};
            for (var i = 0; i < dataOrderList.length; i++) {
                var dataOrder = dataOrderList[i];
                // 代付款的订单特殊处理 如果是同一购物车购买的订单合并到一起
                if ("NOPAY" == dataOrder.orderStatus) {
                    var orderArr = orderMap[dataOrder.paymentId];
                    if (orderArr == null) {
                        orderArr = [];
                        orderMap[dataOrder.paymentId] = orderArr;
                    }
                    orderArr.push(dataOrder);
                } else {
                    orderArray.push([ dataOrder ]);
                }
            }
            // 将合并好的代付款订单也放进数组里
            for (var key in orderMap) {
                // orderArray.push(orderMap[key]);
                orderArray.unshift(orderMap[key]);
            }
            var curTime = new Date().getTime();
            for (var i = 0; i < orderArray.length; i++) {
                //注意头部与列表和底部要传入的数据可能不一样
                var orderArr = orderArray[i];
                var supplier = dataSupplierMap[orderArr[0].supplierId];
                // 获取订单合并的头部 未付款的订单按照购物车合并 其他的按照 商家合并
                var orderGroupHtml;
                if ("NOPAY" == orderArr[0].orderStatus) {
                    orderGroupHtml = "<p>共" + '<span class="">' + orderArr.length + "</span>" + "件商品" + "</p>";
                } else {
                    if ("MULTIGIFT" == orderArr[0].orderType || "GIFT" == orderArr[0].orderType) {
                        orderGroupHtml = [ '<a class="js_goToStore" data-supplierId="' + supplier.supplierId + '">', '   <span class="tip_sendGift">送礼</span>', '   <span class="icon_store iconStyle"></span>', '   <span class="orderShopName">' + supplier.nickName + "</span>", "</a>" ].join("");
                    } else if (orderArr[0].orderSource == "SUPER_TT" || orderArr[0].orderSource == "SUPER_QJ" || orderArr[0].orderSource == "SUPER_QT") {
                        orderGroupHtml = [ '<a class="js_goToStore" data-supplierId="' + supplier.supplierId + '">', '   <span class="tip_sendGift">批</span>', '   <span class="icon_store iconStyle"></span>', '   <span class="orderShopName">' + supplier.nickName + "</span>", "</a>" ].join("");
                    } else {
                        orderGroupHtml = [ '<a class="js_goToStore" data-supplierId="' + supplier.supplierId + '">', '   <span class="icon_store iconStyle"></span>', '   <span class="orderShopName">' + supplier.nickName + "</span>", "</a>" ].join("");
                    }
                }
                // 订单类型
                var orderStatusText;
                if ("2" == orderArr[0].giftOrderShowType) {
                    var remainSecond = parseInt(orderArr[0].remainSecond);
                    if (remainSecond > 0 && orderArr[0].giftRemainQty > 0) {
                        orderStatusText = '距订单关闭还剩 <span class="jsAddressTimer" data-timer="' + remainSecond + '"></span>';
                    } else if (remainSecond > 0 && orderArr[0].giftRemainQty == 0) {
                        orderStatusText = "<span>待发货</span>";
                    } else {
                        orderStatusText = "<span>" + orderArr[0].giftOrderStatusStr + "</span>";
                    }
                } else {
                    switch (orderArr[0].orderStatus) {
                      case "NOPAY":
                        orderStatusText = "待付款";
                        break;

                      case "PAYFINISH":
                        orderStatusText = "待发货";
                        break;

                      case "SHIPPED":
                        orderStatusText = "待收货";
                        break;

                      case "FINISHED":
                        orderStatusText = "交易完成";
                        break;

                      case "WAITING_FILL_ADDR":
                        var remainSecond = parseInt(orderArr[0].remainSecond);
                        orderStatusText = '待TA填地址 <span class="jsAddressTimer" data-timer="' + remainSecond + '"></span>';
                        break;

                      case "CANCEL":
                      case "OVERTIME":
                      case "CLOSEED":
                        orderStatusText = "交易关闭";
                        break;
                    }
                }
                var totalWaitPayAmount = 0;
                var totalAmount = 0;
                for (var idx = 0; idx < orderArr.length; idx++) {
                    totalWaitPayAmount += orderArr[idx].platformAmount;
                    totalAmount += orderArr[idx].paidAmount + orderArr[idx].postFee;
                }
                var orderBtn;
                if ("NOPAY" == orderArr[0].orderStatus) {
                    orderBtn = [ '<div class="waitPayBtn orderAllBtn HBox">', '   <p class="Bflex1 waitPayText">', "       <span>需支付:</span>", '       <span class="needPayNum">', '           <i>￥</i><em class="">' + totalWaitPayAmount.toFixed(2) + "</em>", "       </span>", "   </p>", '   <button class="" type="button" _type="6" oid="' + orderArr[0].paymentId + '">取消订单</button>', '   <button class="redBtn" type="button" _type="5" oid="' + orderArr[0].paymentId + '">去支付</button>', "</div>" ].join("");
                } else {
                    orderBtn = '<div class="transacSuccBtn orderAllBtn HBox">';
                    orderBtn += '<div class="Bflex1"></div>';
                    if (orderArr[0].orderSource == "SUPER_TT" || orderArr[0].orderSource == "SUPER_QJ" || orderArr[0].orderSource == "SUPER_QT") {
                        orderBtn += '<button class="" style="width: 6.8rem" type="button" _type="9">批量下载运单</button>';
                    }
                    if ("FINISHED" == orderArr[0].orderStatus || "OVERTIME" == orderArr[0].orderStatus || "CLOSEED" == orderArr[0].orderStatus) {
                        orderBtn += '<button class="" type="button" _type="0" oid="' + orderArr[0].id + '">删除订单</button>';
                    }
                    if ("WAITING_FILL_ADDR" == orderArr[0].orderStatus) {
                        orderBtn += '<button class="redBtn" type="button" _type="7" oid="' + orderArr[0].paymentId + '">分享给TA</button>';
                    }
                    if ("PAYFINISH" == orderArr[0].orderStatus) {
                        orderBtn += '<button type="button" _type="1" oid="' + orderArr[0].id + '">提醒发货</button>';
                    }
                    if ("GIFT" != orderArr[0].orderType && ("SHIPPED" == orderArr[0].orderStatus || "FINISHED" == orderArr[0].orderStatus)) {
                        orderBtn += '<button class="" type="button" _type="2" oid="' + orderArr[0].id + '" _orderSn="' + orderArr[0].orderSn + '">查看物流</button>';
                    }
                    if ("SHIPPED" == orderArr[0].orderStatus) {
                        orderBtn += '<button class="redBtn" type="button" _type="3" oid="' + orderArr[0].id + '">确认收货</button>';
                    }
                    if ("FINISHED" == orderArr[0].orderStatus) {
                        // console.log("ces1 ++++"+orderArr[0].isGgoodsComment);
                        if (orderArr[0].isGgoodsComment == "1") {
                            orderBtn += '<button class="redBtn" type="button" _type="4" oid="' + orderArr[0].id + '" receiveDate="' + orderArr[0].receiveDate + '">评价有礼</button>';
                        } else if (orderArr[0].isGgoodsComment == "2") {
                            // console.log("ces2 ++++"+orderArr[0].isGgoodsComment);
                            orderBtn += '<button class="redBtn" type="button" _type="8" oid="' + orderArr[0].id + '" receiveDate="' + orderArr[0].receiveDate + '">追加评价</button>';
                        } else if (orderArr[0].isGgoodsComment == "3") {}
                    }
                    orderBtn += "</div>";
                }
                var orderFooterHtml;
                if ("2" == orderArr[0].giftOrderShowType) {
                    //不用显示
                    orderFooterHtml = "";
                } else {
                    var receiverHtml;
                    if ("1" == orderArr[0].giftOrderShowType) {
                        receiverHtml = '<div class="getGiftUser"><span>领取者：' + orderArr[0].giftReceiver + "</span></div>";
                    } else {
                        receiverHtml = "";
                    }
                    orderFooterHtml = [ '       <div class="onOrderFoot">', '           <div class="seletPrice borBEA HBox">', receiverHtml, '               <p class="Bflex1">', '                   <span class="selPriLeft">共<i>' + orderArr.length + "</i>件商品</span>", '                   <span class="selPriTotal">小计：<em>￥</em><span class="sumPrice">' + totalAmount.toFixed(2) + "</span></span>", "               </p>", "           </div>", '           <div class="orderBtnBox">', orderBtn, "           </div>", "       </div>" ].join("");
                }
                var multiGiftClass = "";
                if ("2" == orderArr[0].giftOrderShowType) {
                    //不用显示
                    multiGiftClass = "backWhite moreSendGift";
                }
                shtmlBox += [ '<div class="transactionSuc ' + multiGiftClass + '">', '   <div class="myOrderTranT backWhite">', '       <div class="myOrderShop myFlex myBetween borBEA">', '           <div class="myOrderShopL colTT HBox">', orderGroupHtml, "           </div>", '           <div class="myOrderShopR myFlex colFT">', "               <span>" + orderStatusText + "</span>", "           </div>", "       </div>", orderHtml.orderItemHtml(orderArr), orderFooterHtml, "   </div>", "</div>" ].join("");
            }
            var $shtmlBox = $(shtmlBox);
            oSlidePageScroll.eq(iNow).find(".js_transaction").append($shtmlBox);
            $shtmlBox.find(".jsAddressTimer").each(function() {
                var $timerBox = $(this);
                _this.gitfOrderTimer($timerBox);
            });
            // 执行判断店铺页面链接的方法
            myOrderSwiper.goToStoreEvent();
            //每次拼接完都绑定一次懒加载
            lazLoading.DestroyLazLoadingImg();
            lazLoading.AddLazLoadingImg(oSlidePageScroll[iNow]);
        },
        orderItemHtml: function(orderArr) {
            var shtml = "";
            //可能有很多个商品
            for (var i = 0; i < orderArr.length; i++) {
                var order = orderArr[i];
                for (var idx = 0; idx < order.orderItemVoList.length; idx++) {
                    var orderItem = order.orderItemVoList[idx];
                    var href = BASE_URL + "/shop/pay/order_view?orderSn=" + order.orderSn + "&orderStatus=" + order.orderStatus;
                    if ("NOPAY" == order.orderStatus) {
                        //首先判断是否是待支付的单
                        href = "/shop/pay/order_confirm?paymentId=" + order.paymentId;
                    } else if ("2" == order.giftOrderShowType) {
                        href = "/shop/gift/multiGiftOrderEntryDetail?paymentOrderId=" + order.paymentId;
                    }
                    var productNameAreaHtml;
                    var productPriceAreaHtml;
                    var shareTaHtml;
                    if ("2" == order.giftOrderShowType) {
                        var remainSecond = parseInt(order.remainSecond);
                        productPriceAreaHtml = [ '           <div class="priceArea_price HBox">', '               <p class="priceAreaBox Bflex1"><span class="goodsPriceOld">￥' + orderItem.productPrice + "</span></p>", "           </div>" ].join("");
                        if (remainSecond > 0) {
                            productNameAreaHtml = [ '<div class="Bflex1 priceArea_name">', "<h4>" + orderItem.goodsName + "</h4>", '<p class="smallFont_tip">', "<span>剩余" + order.giftRemainQty + "个未领取</span>", "<span>/</span>", "<span>共" + order.giftTotalQty + "个</span>", "</p>", "</div>" ].join("");
                            if (order.giftRemainQty > 0) {
                                shareTaHtml = '<p class="shareTABtn"><a href="/shop/gift/sharePage/' + order.paymentId + '" class="btnStyle btn_BorderGray">分享给Ta</a></p>';
                            }
                        } else {
                            if (order.giftRemainQty > 0) {
                                productNameAreaHtml = [ '<div class="Bflex1 priceArea_name">', "<h4>" + orderItem.goodsName + "</h4>", '<p class="smallFont_tip">', "<span>剩余" + order.giftRemainQty + "个未领取已退款</span>", "</p>", "</div>" ].join("");
                            } else {
                                productNameAreaHtml = [ '<div class="Bflex1 priceArea_name">', "<h4>" + orderItem.goodsName + "</h4>", '<p class="smallFont_tip">', "<span>已抢光</span>", "</p>", "</div>" ].join("");
                            }
                            shareTaHtml = '<p class="shareTABtn"><a href="/shop/gift/multiGiftOrderEntryDetail?paymentOrderId=' + order.paymentId + '" class="btnStyle btn_BorderGray">查看详情</a></p>';
                        }
                    } else {
                        var jifenHtml = "";
                        if (orderItem.isJifen != false) {
                            if (orderItem.productPrice == 0) {
                                jifenHtml = '<p class="priceAreaBox Bflex1"><span class="goodsPriceOld">￥' + orderItem.memberPoint + "积分" + "</span></p>";
                            } else {
                                jifenHtml = '<p class="priceAreaBox Bflex1"><span class="goodsPriceOld">￥' + orderItem.productPrice + "+" + orderItem.memberPoint + "积分" + "</span></p>";
                            }
                        } else {
                            jifenHtml = '<p class="priceAreaBox Bflex1"><span class="goodsPriceOld">￥' + orderItem.productPrice + "</span></p>";
                        }
                        productNameAreaHtml = [ '           <div class="Bflex1 priceArea_name">', "               <h4>" + orderItem.goodsName + "</h4>", '               <p class="smallFont_tip"><span>规格:</span><span>已选择' + orderItem.productName + "</span></p>", "           </div>" ].join("");
                        productPriceAreaHtml = [ '           <div class="priceArea_price HBox">', jifenHtml, '               <p class="selProNum"><span>×</span><span class="proNumber">' + orderItem.quantity + "</span></p>", "           </div>" ].join("");
                        shareTaHtml = "";
                    }
                    shtml += [ "<li>" + '   <a class="BoxSelf" href="' + href + '">', "       <figure>", '           <img class="js_lazyImg fadeIn" data-echo="' + HTTP_IMAGE_URL + orderItem.goodsImage + smallImgArg200 + '" src="' + BASE_URL + '/static_v4/image/loadImg.jpg">', "       </figure>", '       <aside class="priceArea VBox Bflex1">', productNameAreaHtml, productPriceAreaHtml, "       </aside>", "   </a>", shareTaHtml, "</li>" ].join("");
                }
            }
            shtmlBox = [ '<div class="orderProduction goods_showChangeBox">', '   <div class="goods_showChange">', '       <ul class="goodsList clearfix js_goodsList">' + shtml + "</ul>", "   </div>", "</div>" ].join("");
            return shtmlBox;
        },
        gitfOrderTimer: function(timerBox) {
            var _this = this;
            var timerSecond = parseInt(timerBox.attr("data-timer"));
            var timerText = _this.formatTimer(timerSecond);
            timerBox.text(timerText);
            var tempTimerInterval = setInterval(function() {
                timerSecond--;
                var timerText = _this.formatTimer(timerSecond);
                timerBox.text(timerText);
                if (timerSecond <= 0) {
                    clearInterval(tempTimerInterval);
                }
            }, 1e3);
        },
        formatTimer: function(timerSecond) {
            var second = timerSecond % 60;
            var min = (timerSecond - timerSecond % 60) / 60 % 60;
            var honr = (timerSecond - timerSecond % 3600) / 3600;
            // console.log("%o  %o  %o  %o",timerSecond,honr,min,second);
            if (honr < 10) {
                honr = "0" + honr;
            }
            if (min < 10) {
                min = "0" + min;
            }
            if (second < 10) {
                second = "0" + second;
            }
            var timerText = honr + ":" + min + ":" + second;
            return timerText;
        },
        // 无订单页面
        noOrderPage: function() {
            var noHtml = "";
            noHtml = '<div class="errPage VBox" style="background: #f1f1f1">' + '   <div class="errImgBox halfImgBox">' + '       <figure class="errImg errImgFig" style="margin-top: 1rem;">' + '           <img src="' + BASE_URL + '/static_v4/image/wonderful/goods-null_trans.png" alt="">' + "       </figure>" + "   </div>" + '   <div class="errTxt Bflex1" style="margin-bottom: 1.5rem">' + "       <p>没有订单信息哦~</p>" + '       <p class="jumpHref"><a class="laterCome" href="' + BASE_URL + '/home">回首页</a></p>' + "   </div>" + "</div>";
            return noHtml;
        }
    };
});
define("static_v4/js/mod/swiperAds", [ "./visualAreaInfo" ], function(require, exports, module) {
    // 曝光可视区域元素
    var visualArea = require("./visualAreaInfo");
    //广告轮播
    var oSilderImg = $(".js_silderImg");
    //广告轮播框
    var oPagin = $(".js_pagin");
    //个数点
    var indexSwiperAD = [];
    var locationHref = window.location.href;
    var LoopOff = true;
    var ddjAction = "";
    var ddjActionOff = true;
    var ddjActionPositionId = {};
    // 判断是物品详情时 做处理
    if (locationHref.indexOf("h/goodspay/goodsView") > 1) {
        LoopOff = false;
        ddjActionPositionId.positionId = 2;
    }
    /*----2018-4-13-lou添加------*/
    var resizeTimer = null;
    var oWindow = $(window);
    Swiper_indexAD();
    // 页面尺寸修改
    oWindow.on("resize", function() {
        if (resizeTimer) {
            clearTimeout(resizeTimer);
        }
        resizeTimer = setTimeout(function() {
            Swiper_indexAD();
        }, 400);
    });
    function Swiper_indexAD() {
        oSilderImg.each(function(i) {
            // 设置滚动条展示位置 1 为首页
            if (oSilderImg.eq(i).parents(".js_slidePageWrap").length > 0) {
                ddjActionPositionId.positionId = 1;
                // ddjActionPositionId.positionType = '首页-推荐';
                ddjActionPositionId.positionFirst = "首页";
                ddjActionPositionId.positionSecond = "推荐";
            }
            if (indexSwiperAD[i] == undefined || indexSwiperAD[i] === "") {
                if (oSilderImg.eq(i).find(".swiper-slide").length < 2) {} else {
                    indexSwiperAD = oSilderImg.eq(i).swiper({
                        pagination: oPagin.eq(i),
                        loop: LoopOff,
                        autoplay: 3e3,
                        autoplayDisableOnInteraction: false,
                        onSlideChangeEnd: function(swiper) {
                            var index = swiper.activeIndex;
                            var _iNow = 0;
                            if (LoopOff) _iNow = 1;
                        },
                        onReachEnd: function() {
                            // console.log('最后一个了')
                            ddjActionOff = false;
                        }
                    });
                }
            } else {
                indexSwiperAD[i].onResize();
            }
        });
    }
    // 用户行为
    ddjAction = {
        viewGoods: function(obj) {
            // 统计曝光数据
            visualArea.viewEl.showViewEls(obj, function(data, dataJson) {
                ddjhoc.setData(data, "rec_show", "add", function() {
                    // console.log('ddjhoc.params.rec_show.swiperAds', ddjhoc.params);
                    if (ddjhoc.params.length != 0) ddjhoc.sendData(ddjhoc.params);
                    console.log("ddjhoc.ddjParams.rec_show.swiperAds", ddjhoc.ddjParams);
                    if (ddjhoc.ddjParams.length != 0) ddjhoc.sendDDJData(ddjhoc.ddjParams);
                }, dataJson, ddjActionPositionId);
            });
        }
    };
});
define("static_v4/js/mod/myOrderSearch_sea", [ "./public" ], function(require, exports, module) {
    var myPub = require("./public");
    var oWindow = $(window);
    var oOrderSearchArea = $(".js_orderSearchArea");
    // 我的订单页搜索入口
    var oSlideSearchBox = $(".js_slideSearchBox");
    // 侧滑的搜索页面
    var nSildeWidth = oSlideSearchBox.outerWidth(true);
    // 整个侧边搜索区域的宽度
    var lazLoading = new myPub.lazLoadingImg();
    var isInit = true;
    // 获取节点
    var bSearch = false;
    // 是否展示搜索页
    var searchWord = "";
    // 搜索的关键字
    var resizeTimer = null;
    // 搜索数据路径
    var searchUrl = "/m/o/1.0/order/mySearch";
    var storeDetailUrl = "/m/g/supplier/1.0/isOverSeaSupplier";
    // 判断是进入海外店铺还是进入普通店铺的接口
    // 搜索列表
    var searchOrder = {
        oNoOrder: "",
        oSlideSearchArea: "",
        oSlideSearchCancel: "",
        oSlideOrder: "",
        nSlideSearchHeight: "",
        oSlideSearchText: "",
        oSearchOrederList: "",
        oClearSearchBtn: "",
        oHasSearchData: "",
        oMoreBtnBox: "",
        limit: 10,
        // 每次加载多少数据
        getData: [],
        // 数据记录
        pagearr: 1,
        // 当前页码
        start: 0,
        // 开始数据
        bLoadOff: true,
        // 加载开关
        bScrollLoadOff: true,
        // 滚动加载开关
        scroll_timer: null,
        // 滚动定时器
        // 初始化
        init: function() {
            var _this = this;
            _this.oSlideSearchArea = $(".js_slideSearchArea");
            // 搜索区域
            _this.oSlideSearchText = $(".js_slideSearchText");
            // 输入框
            _this.oClearSearchBtn = $(".js_clearSearchBtn");
            // 清空输入框按钮
            _this.oSlideSearchCancel = $(".js_slideSearchCancel");
            // 取消按钮
            _this.oSlideOrder = $(".js_slideOrder");
            // 显示订单区域
            _this.oHasSearchData = $(".js_hasSearhData");
            // 有数据时显示内容
            _this.oNoOrder = $(".js_noOrder");
            // 没有订单的页面
            _this.oSearchOrederList = $(".js_searchOrederList");
            // 搜索到的订单区域
            _this.oMoreBtnBox = $(".js_moreBtnBox");
            // 没有更多了或者加载中的按钮
            _this.nSlideSearchHeight = _this.oSlideSearchArea.outerHeight(true);
            // 顶部搜索区域的高度
            oSlideSearchBox.css({
                left: nSildeWidth + 10 + "px"
            });
            // 侧边搜索栏是否显示
            _this.oSlideOrder.css({
                height: oWindow.height() - _this.nSlideSearchHeight,
                "padding-top": _this.nSlideSearchHeight
            });
            // 取消按钮
            _this.oSlideSearchCancel.on("click", function(e) {
                bSearch = false;
                oSlideSearchBox.stop().animate({
                    left: nSildeWidth + 10 + "px"
                }, 300, function() {
                    oSlideSearchBox.hide();
                });
                e.stopPropagation();
            });
        },
        // 检测输入框
        getInputData: function() {
            var _this = this;
            // 输入是显示隐藏清空按钮
            _this.oSlideSearchText.on("input propertychange", function() {
                var searchVal = _this.oSlideSearchText.val();
                if (searchVal.length > 0) {
                    _this.oClearSearchBtn.show();
                } else {
                    _this.oClearSearchBtn.hide();
                }
            });
            // 获取焦点时显示隐藏清空按钮
            _this.oSlideSearchText.on("focus", function() {
                var searchVal = _this.oSlideSearchText.val();
                if (searchVal.length > 0) {
                    _this.oClearSearchBtn.show();
                } else {
                    _this.oClearSearchBtn.hide();
                }
            });
            // 点击清空按钮清空输入框
            _this.oClearSearchBtn.on("click", function(e) {
                _this.oSlideSearchText.val("");
                e.stopPropagation();
            });
        },
        // 获取数据
        getSearchData: function(keyWord) {
            var _this = this;
            G_JSON_POST(searchUrl, {
                keyword: keyWord,
                start: _this.start,
                limit: _this.limit
            }, function(data) {
                var dataItem = data;
                if (dataItem.ret.code == "0") {
                    if (dataItem.data == null && _this.pagearr < 2) {
                        // 关闭滚动加载
                        _this.bScrollLoadOff = false;
                        // 显示没有数据页面
                        _this.oNoOrder.show();
                        _this.oHasSearchData.hide();
                        return;
                    }
                    if (dataItem.data == null && _this.pagearr > 1) {
                        // 关闭滚动加载
                        _this.bScrollLoadOff = false;
                        // 显示没有更多了
                        _this.oMoreBtnBox.find(".js_loadingBtn").eq(1).hide();
                        _this.oMoreBtnBox.find(".js_loadingBtn").eq(0).show();
                        return;
                    }
                    _this.getSearchHtml(dataItem.data);
                    if (dataItem.data && dataItem.data.length < _this.limit) {
                        // 关闭滚动加载
                        _this.bScrollLoadOff = false;
                        // 显示没有更多了
                        _this.oMoreBtnBox.find(".js_loadingBtn").eq(1).hide();
                        _this.oMoreBtnBox.find(".js_loadingBtn").eq(0).show();
                    }
                } else {
                    // 关闭滚动加载
                    _this.bScrollLoadOff = false;
                    // 显示没有数据页面
                    _this.oNoOrder.show();
                    _this.oHasSearchData.hide();
                }
            });
        },
        // 滚动加载
        scrollData: function() {
            var _this = this;
            var minHeight = 200;
            // 滚动到离底部的距离然后加载数据
            _this.oSlideOrder.off("scroll");
            _this.oSlideOrder.on("scroll", function() {
                var afterScroll = $(this).scrollTop();
                clearTimeout(_this.scroll_timer);
                _this.scroll_timer = setTimeout(function() {
                    if (_this.oSlideOrder[0].scrollHeight - afterScroll - _this.oSlideOrder.height() < minHeight) {
                        if (_this.bScrollLoadOff) {
                            _this.start = _this.limit * _this.pagearr;
                            _this.pagearr++;
                            _this.getSearchData(searchWord);
                        }
                    }
                }, 200);
            });
        },
        // 拼接订单
        getSearchHtml: function(orderArr) {
            var _this = this;
            var UlHtml = "";
            var tHtml = "";
            for (var i = 0; i < orderArr.length; i++) {
                var arrItem = orderArr[i];
                var multiGiftClass = "";
                tHtml = "";
                // 商品  部分
                var href = BASE_URL + "/shop/pay/order_view?orderSn=" + arrItem.orderSn + "&orderStatus=" + arrItem.orderStatus;
                if (arrItem.giftOrderShowType == "2") {
                    multiGiftClass = "backWhite moreSendGift";
                    href = "/shop/gift/multiGiftOrderEntryDetail?paymentOrderId=" + arrItem.paymentOrderId;
                }
                for (var j = 0; j < arrItem.orderItemVOList.length; j++) {
                    var goodsItem = arrItem.orderItemVOList[j];
                    var productNameAreaHtml;
                    var productPriceAreaHtml;
                    var shareTaHtml;
                    if (arrItem.giftOrderShowType == "2") {
                        var remainSecond = parseInt(arrItem.remainSecond);
                        productPriceAreaHtml = [ '           <div class="priceArea_price HBox">', '               <p class="priceAreaBox Bflex1"><span class="goodsPriceOld">￥' + goodsItem.productPrice + "</span></p>", "           </div>" ].join("");
                        if (remainSecond > 0) {
                            productNameAreaHtml = [ '<div class="Bflex1 priceArea_name">', "<h4>" + goodsItem.goodsName + "</h4>", '<p class="smallFont_tip">', "<span>剩余" + arrItem.giftRemainQty + "个未领取</span>", "<span>/</span>", "<span>共" + arrItem.giftTotalQty + "个</span>", "</p>", "</div>" ].join("");
                            if (arrItem.giftRemainQty > 0) {
                                shareTaHtml = '<p class="shareTABtn"><a href="/shop/gift/sharePage/' + arrItem.paymentOrderId + '" class="btnStyle btn_BorderGray">分享给Ta</a></p>';
                            }
                        } else {
                            if (arrItem.giftRemainQty > 0) {
                                productNameAreaHtml = [ '<div class="Bflex1 priceArea_name">', "<h4>" + goodsItem.goodsName + "</h4>", '<p class="smallFont_tip">', "<span>剩余" + arrItem.giftRemainQty + "个未领取已退款</span>", "</p>", "</div>" ].join("");
                            } else {
                                productNameAreaHtml = [ '<div class="Bflex1 priceArea_name">', "<h4>" + goodsItem.goodsName + "</h4>", '<p class="smallFont_tip">', "<span>已抢光</span>", "</p>", "</div>" ].join("");
                            }
                            shareTaHtml = '<p class="shareTABtn"><a href="/shop/gift/multiGiftOrderEntryDetail?paymentOrderId=' + arrItem.paymentOrderId + '" class="btnStyle btn_BorderGray">查看详情</a></p>';
                        }
                    } else {
                        var jifenHtml = "";
                        if (goodsItem.isJifen != false) {
                            if (goodsItem.productPrice == 0) {
                                jifenHtml = '<p class="priceAreaBox Bflex1"><span class="goodsPriceOld">￥' + goodsItem.memberPoint + "积分" + "</span></p>";
                            } else {
                                jifenHtml = '<p class="priceAreaBox Bflex1"><span class="goodsPriceOld">￥' + goodsItem.productPrice + "+" + goodsItem.memberPoint + "积分" + "</span></p>";
                            }
                        } else {
                            jifenHtml = '<p class="priceAreaBox Bflex1"><span class="goodsPriceOld">￥' + goodsItem.productPrice + "</span></p>";
                        }
                        productNameAreaHtml = [ '           <div class="Bflex1 priceArea_name">', "               <h4>" + goodsItem.goodsName + "</h4>", '               <p class="smallFont_tip"><span>规格:</span><span>已选择' + goodsItem.productName + "</span></p>", "           </div>" ].join("");
                        productPriceAreaHtml = [ '           <div class="priceArea_price HBox">', jifenHtml, '               <p class="selProNum">' + '                   <span>×</span><span class="proNumber">' + goodsItem.quantity + "</span>" + "               </p>", "             </div>" ].join("");
                        shareTaHtml = "";
                    }
                    tHtml += [ "<li>" + '   <a class="BoxSelf" href="' + href + '">', "       <figure>", '           <img class="js_lazyImg fadeIn" data-echo="' + HTTP_IMAGE_URL + goodsItem.goodsImage + smallImgArg200 + '" src="' + BASE_URL + '/static_v4/image/loadImg.jpg">', "       </figure>", '       <aside class="priceArea VBox Bflex1">', productNameAreaHtml, productPriceAreaHtml, "       </aside>", "   </a>", shareTaHtml, "</li>" ].join("");
                }
                // 获取订单合并的头部 未付款的订单按照购物车合并 其他的按照 商家合并
                var orderGroupHtml;
                if (arrItem.giftOrderShowType != "0") {
                    orderGroupHtml = [ '<a class="js_goToStore" data-supplierId="' + arrItem.supplierId + '">', '   <span class="tip_sendGift">送礼</span>', '   <span class="icon_store iconStyle"></span>', '   <span class="orderShopName">' + arrItem.supplierName + "</span>", "</a>" ].join("");
                } else {
                    orderGroupHtml = [ '<a  class="js_goToStore" data-supplierId="' + arrItem.supplierId + '">', '   <span class="icon_store iconStyle"></span>', '   <span class="orderShopName">' + arrItem.supplierName + "</span>", "</a>" ].join("");
                }
                // 订单类型
                var orderStatusText;
                if (arrItem.giftOrderShowType == "2") {
                    var remainSecond = parseInt(arrItem.remainSecond);
                    if (remainSecond > 0 && arrItem.giftRemainQty > 0) {
                        orderStatusText = '距订单关闭还剩 <span class="jsAddressTimer" data-timer="' + remainSecond + '"></span>';
                    } else if (remainSecond > 0 && arrItem.giftRemainQty == 0) {
                        orderStatusText = "<span>待发货</span>";
                    } else {
                        orderStatusText = "<span>" + arrItem.giftOrderStatusStr + "</span>";
                    }
                } else {
                    switch (arrItem.orderStatus) {
                      case "PAYFINISH":
                        orderStatusText = "待发货";
                        break;

                      case "SHIPPED":
                        orderStatusText = "待收货";
                        break;

                      case "FINISHED":
                        orderStatusText = "交易完成";
                        break;

                      case "WAITING_FILL_ADDR":
                        var remainSecond = parseInt(arrItem.remainSecond);
                        orderStatusText = '待TA填地址 <span class="jsAddressTimer" data-timer="' + remainSecond + '"></span>';
                        break;

                      case "CANCEL":
                      case "OVERTIME":
                      case "CLOSEED":
                        orderStatusText = "交易关闭";
                        break;
                    }
                }
                // 订单底部按钮
                var totalAmount = arrItem.paidAmount;
                var orderBtn;
                orderBtn = '<div class="transacSuccBtn orderAllBtn HBox">';
                orderBtn += '<div class="Bflex1"></div>';
                if ("FINISHED" == arrItem.orderStatus || "OVERTIME" == arrItem.orderStatus || "CLOSEED" == arrItem.orderStatus) {
                    orderBtn += '<button class="" type="button" _type="0" oid="' + arrItem.id + '">删除订单</button>';
                }
                if ("WAITING_FILL_ADDR" == arrItem.orderStatus) {
                    orderBtn += '<button class="redBtn" type="button" _type="7" oid="' + arrItem.paymentOrderId + '">分享给TA</button>';
                }
                if ("PAYFINISH" == arrItem.orderStatus) {
                    orderBtn += '<button type="button" _type="1" oid="' + arrItem.id + '">提醒发货</button>';
                }
                if (arrItem.giftOrderShowType != "1" && ("SHIPPED" == arrItem.orderStatus || "FINISHED" == arrItem.orderStatus)) {
                    orderBtn += '<button class="" type="button" _type="2" oid="' + arrItem.id + '" _orderSn="' + arrItem.orderSn + '">查看物流</button>';
                }
                if ("SHIPPED" == arrItem.orderStatus) {
                    orderBtn += '<button class="redBtn" type="button" _type="3" oid="' + arrItem.id + '">确认收货</button>';
                }
                if ("FINISHED" == arrItem.orderStatus) {
                    // console.log("ces1 ++++"+orderArr[0].isGgoodsComment);
                    if (arrItem.isGoodsComment == "1") {
                        orderBtn += '<button class="redBtn" type="button" _type="4" oid="' + arrItem.id + '" >评价有礼</button>';
                    } else if (arrItem.isGoodsComment == "2") {
                        // console.log("ces2 ++++"+orderArr[0].isGgoodsComment);
                        orderBtn += '<button class="redBtn" type="button" _type="8" oid="' + arrItem.id + '">追加评价</button>';
                    } else if (arrItem.isGoodsComment == "3") {}
                }
                orderBtn += "</div>";
                var orderFooterHtml;
                if (arrItem.giftOrderShowType == "2") {
                    //不用显示
                    orderFooterHtml = "";
                } else {
                    var receiverHtml;
                    if (arrItem.giftOrderShowType == "1" && arrItem.giftRemainQty != "1") {
                        receiverHtml = '<div class="getGiftUser"><span>领取者：' + arrItem.giftReceiver + "</span></div>";
                    } else {
                        receiverHtml = "";
                    }
                    orderFooterHtml = [ '<div class="onOrderFoot">', '           <div class="seletPrice borBEA HBox">', receiverHtml, '               <p class="Bflex1">', '                   <span class="selPriLeft">共<i>' + arrItem.quantity + "</i>件商品</span>", '                   <span class="selPriTotal">小计：<em>￥</em><span class="sumPrice">' + totalAmount.toFixed(2) + "</span></span>", "               </p>", "           </div>", '           <div class="orderBtnBox">', orderBtn, "           </div>", "       </div>" ].join("");
                }
                UlHtml += "<li>" + '   <div class="transactionSuc ' + multiGiftClass + '">' + '       <div class="myOrderTranT backWhite">' + '           <div class="myOrderShop myFlex myBetween borBEA">' + '               <div class="myOrderShopL colTT HBox">' + orderGroupHtml + "               </div>" + '               <div class="myOrderShopR myFlex colFT">' + "                   <span>" + orderStatusText + "</span>" + "               </div>" + "           </div>" + '           <div class="orderProduction goods_showChangeBox">' + '               <div class="goods_showChange">' + '                   <ul class="goodsList clearfix js_goodsList">' + tHtml + "                   </ul>" + "               </div>" + "           </div>" + orderFooterHtml + "       </div>" + "   </div>" + "</li>";
            }
            var $shtmlBox = $(UlHtml);
            _this.oSearchOrederList.append($shtmlBox);
            _this.oMoreBtnBox.show();
            $shtmlBox.find(".jsAddressTimer").each(function() {
                var $timerBox = $(this);
                _this.gitfOrderTimer($timerBox);
            });
            // 执行判断进哪个商详页
            _this.goToStoreEvent();
            lazLoading.DestroyLazLoadingImg();
            lazLoading.AddLazLoadingImg(_this.oSearchOrederList[0]);
        },
        // 倒计时
        gitfOrderTimer: function(timerBox) {
            var _this = this;
            console.log('timerBox.attr("data-timer")', timerBox.attr("data-timer"));
            var timerSecond = parseInt(timerBox.attr("data-timer"));
            var timerText = _this.formatTimer(timerSecond);
            timerBox.text(timerText);
            var tempTimerInterval = setInterval(function() {
                timerSecond--;
                var timerText = _this.formatTimer(timerSecond);
                timerBox.text(timerText);
                if (timerSecond <= 0) {
                    clearInterval(tempTimerInterval);
                }
            }, 1e3);
        },
        formatTimer: function(timerSecond) {
            var second = timerSecond % 60;
            var min = (timerSecond - timerSecond % 60) / 60 % 60;
            var honr = (timerSecond - timerSecond % 3600) / 3600;
            // console.log("%o  %o  %o  %o",timerSecond,honr,min,second);
            if (honr < 10) {
                honr = "0" + honr;
            }
            if (min < 10) {
                min = "0" + min;
            }
            if (second < 10) {
                second = "0" + second;
            }
            var timerText = honr + ":" + min + ":" + second;
            return timerText;
        },
        // 判断是进入海外店铺还是进入普通店铺的接口
        goToStoreDetail: function(supplierId) {
            var _this = this;
            G_JSON_POST(storeDetailUrl, {
                supplierId: supplierId
            }, function(data) {
                var _data = data.data;
                var _ret = data.ret;
                // console.log('data',_data,_ret);
                if (_ret.code == "0") {
                    if (_data) {
                        // 海外馆商家
                        window.location.href = BASE_URL + "/h/store/storehome?supplierId=" + supplierId;
                    } else {
                        // 普通商家
                        window.location.href = BASE_URL + "/h/store/normalStore/" + supplierId;
                    }
                } else {
                    // 如果请求不到就跳转普通商家
                    window.location.href = BASE_URL + "/h/store/normalStore/" + supplierId;
                }
            });
        },
        // 点击进入店铺详情页面要判断是否是海外店铺
        goToStoreEvent: function() {
            var _this = this;
            $(".js_goToStore").on("click", function() {
                var supplierId = $(this).attr("data-supplierId");
                _this.goToStoreDetail(supplierId);
            });
        }
    };
    // searchOrder.getSearchData();
    // 显示搜索页面
    oOrderSearchArea.on("click", function(e) {
        // console.log('123',nSildeWidth);
        oSlideSearchBox.show();
        bSearch = true;
        // 初始化一次即可
        if (isInit) {
            // 初始化 获取节点等
            searchOrder.init();
            // 显示隐藏清空按钮以及点击清空按钮操作
            searchOrder.getInputData();
            // 滚动加载
            searchOrder.scrollData();
        }
        // 清空数据  如果有之前的数据未清空
        searchOrder.oSlideSearchText.val("");
        searchOrder.oSearchOrederList.html("");
        searchOrder.oMoreBtnBox.hide();
        searchOrder.oClearSearchBtn.hide();
        searchOrder.oNoOrder.hide();
        searchOrder.oHasSearchData.show();
        searchOrder.pagearr = 1;
        searchOrder.start = 0;
        oSlideSearchBox.stop().animate({
            left: 0
        }, 300, function() {});
        isInit = false;
        e.stopPropagation();
    });
    // 回车键请求数据
    oSlideSearchBox.on("keydown", function(event) {
        // 页面在搜索区域的情况才能执行
        if (bSearch && event.keyCode == 13) {
            // 搜索关键字
            searchWord = searchOrder.oSlideSearchText.val();
            if (searchWord != "") {
                // 清空之前搜索的数据  点取消的时候要不要清空数据
                searchOrder.oSearchOrederList.html("");
                searchOrder.oMoreBtnBox.hide();
                searchOrder.pagearr = 1;
                searchOrder.start = 0;
                // 失去焦点
                searchOrder.oSlideSearchText.blur();
                // 显示有数据页面
                searchOrder.oNoOrder.hide();
                searchOrder.oHasSearchData.show();
                // 再请求数据
                searchOrder.getSearchData(searchWord);
            } else {
                myPub.TipLayer("您未输入搜索内容哦~");
            }
        } else {}
    });
});
var baseurl = "";

var smallImgArg = "?x-oss-process=style/goods_img_3";

var smallImgArg300 = "?x-oss-process=style/goods_img_2";

var smallImgArg200 = "?x-oss-process=style/goods_img";

function check_support_webp() {
    var isSupportWebp = document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp") == 0;
    return isSupportWebp;
}

if (check_support_webp()) {
    smallImgArg = "?x-oss-process=style/goods_webp_3";
    smallImgArg300 = "?x-oss-process=style/goods_webp_2";
    smallImgArg200 = "?x-oss-process=style/goods_webp";
}

define("static_v4/js/mod/public", [], function(require, exports, module) {
    //yx
    //var httpImageUrl="https://fm95338bucket.oss-cn-shenzhen.aliyuncs.com/";
    //zs
    //var httpImageUrl="https://sfddj-img-bucket.oss-cn-shenzhen.aliyuncs.com/";
    var httpImageUrl;
    var myDoMain = "";
    if (window.location.host == "m.sfddj.com" || window.location.host == "120.76.47.184" || window.location.host == "120.76.207.85" || window.location.host == "120.76.44.28") {
        // httpImageUrl="https://sfddj-img-bucket.oss-cn-shenzhen.aliyuncs.com/";
        httpImageUrl = "https://img.sfddj.com/";
        myDoMain = "https://m.sfddj.com";
    } else if (window.location.host == "hdm.sfddj.com") {
        httpImageUrl = "https://img.sfddj.com/";
        myDoMain = "https://hdm.sfddj.com";
    } else if (window.location.host == "itsm.sfddj.com") {
        // httpImageUrl="https://fm95338bucket.oss-cn-shenzhen.aliyuncs.com/";
        httpImageUrl = "https://img.fx-sf.com/";
        myDoMain = "https://itsm.sfddj.com";
    } else if (window.location.host == "shop.fx-sf.com") {
        // httpImageUrl="https://fm95338bucket.oss-cn-shenzhen.aliyuncs.com/";
        httpImageUrl = "https://img.fx-sf.com/";
        myDoMain = "https://shop.fx-sf.com";
    } else if (window.location.host == "www.shhyxypsx.com") {
        httpImageUrl = "https://img.fx-sf.com/";
        myDoMain = "https://www.shhyxypsx.com";
    } else if (window.location.hostname == "localhost") {
        httpImageUrl = "http://img-dev.sfddj.com/";
        myDoMain = "http://localhost:8082";
    }
    exports.httpImageUrl = httpImageUrl;
    exports.myDoMain = myDoMain;
    //加入购物车的动画
    function AddCarAnimate(_X, _Y, target, sLeft, sTop, offsetDis, callBack) {
        // var _X = e.gesture.center.x;
        // var _Y = e.gesture.center.y;
        var time = null;
        var timeTwo = null;
        target.removeClass("myRotateFast");
        target.css({
            left: _X,
            top: _Y,
            opacity: 1
        });
        clearTimeout(time);
        time = setTimeout(function() {
            target.addClass("myRotateFast").stop().animate({
                left: _X,
                top: _Y - 50,
                opacity: 1
            }, 300, function() {
                target.stop().animate({
                    left: sLeft,
                    top: sTop
                }, 600, function() {
                    target.removeClass("myRotateFast");
                    clearTimeout(timeTwo);
                    timeTwo = setTimeout(function() {
                        target.stop().animate({
                            top: sTop + offsetDis * 2,
                            opacity: 0
                        }, 200, function() {
                            if (callBack) callBack();
                        });
                    }, 200);
                });
            });
        }, 30);
    }
    exports.AddCarAnimate = AddCarAnimate;
    // hammer 冒泡
    function HamstopPropaga() {
        window.event.returnValue = false;
        return false;
    }
    exports.HamstopPropaga = HamstopPropaga;
    //hammer事件
    function HammerEvent(obj) {
        this.obj = obj;
    }
    HammerEvent.prototype.addHamEvent = function(obj, type, fn) {
        this.obj = new Hammer.Manager(obj);
        this.obj.add(new Hammer.Pan({
            velocity: 0,
            threshold: 120,
            direction: Hammer.DIRECTION_ALL
        }));
        //平滑
        this.obj.add(new Hammer.Swipe({
            threshold: 8,
            direction: Hammer.DIRECTION_ALL
        }));
        this.obj.add(new Hammer.Tap({}));
        this.obj.add(new Hammer.Press({
            velocity: .6,
            threshold: 8
        }));
        //长时间下压
        this.obj.off(type);
        this.obj.on(type, function(e) {
            if (fn) fn(e);
        });
    };
    exports.HammerEvent = HammerEvent;
    /* 数字验证 */
    function ValiNum(obj, fn1, fn2) {
        var reg = new RegExp("^[0-9]*$");
        if (!reg.test(obj.val())) {
            if (fn1) fn1();
        } else if (obj.val() <= 0) {
            // TipLayer("数量不能小余1");
            obj.val(1);
        } else {
            if (fn2) fn2();
        }
    }
    exports.ValiNum = ValiNum;
    /* 字数统计 */
    function statInputNum(textArea, numItem) {
        var max = [];
        var curLength = [];
        textArea.each(function(i) {
            max[i] = parseInt(numItem.eq(i).text());
            if (textArea.eq(i).val().length > 0) {
                curLength[i] = textArea.eq(i).val().length;
                numItem.eq(i).empty().text(max[i] - curLength[i]);
            }
            textArea.eq(i).attr("maxlength", max[i]).on("input propertychange", function() {
                curLength[i] = $(this).val().length;
                numItem.eq(i).empty().text(max[i] - curLength[i]);
            });
        });
    }
    exports.statInputNum = statInputNum;
    /* 购物车价格统计 */
    function ShopSumPrice(obj, tarFather, target, sumPrice) {
        var _price = 0;
        obj.each(function(i) {
            if (obj.eq(i).hasClass("active")) {
                var _oGoodsPrice = obj.eq(i).parents(tarFather).find(target);
                _oGoodsPrice.each(function(i) {
                    _price += _oGoodsPrice.eq(i).text() * 1;
                    return _price;
                });
            }
        });
        sumPrice.text(_price.toFixed(2));
    }
    exports.ShopSumPrice = ShopSumPrice;
    /*************** 弹框效果 s***************/
    //提示框
    function TipLayer(sCont, sStyle, fn, T) {
        layer.open({
            content: sCont,
            style: sStyle != "no" ? sStyle : "background-color:rgba(255,255,255,1); color:#252525; border:none; border-radius: 5px;",
            scrollbar: false,
            time: T || 2,
            shadeClose: false,
            success: function() {
                if (fn) fn();
            }
        });
        NoTouchMove($(".laymshade"));
    }
    exports.TipLayer = TipLayer;
    //提示框_没有遮罩层
    function TipLayer_noShade(sCont, sStyle, fn, T) {
        layer.open({
            content: sCont,
            style: sStyle != "no" ? sStyle : "background-color:rgba(255,255,255,1); color:#252525; border:none; border-radius: 5px;",
            scrollbar: false,
            time: T || 2,
            shade: false,
            shadeClose: false,
            success: function() {
                if (fn) fn();
            }
        });
        NoTouchMove($(".laymshade"));
    }
    exports.TipLayer_noShade = TipLayer_noShade;
    //框消失后执行回调提示框
    function TipLayerEnd(sCont, sStyle, fn, T) {
        layer.open({
            content: sCont,
            style: sStyle != "no" ? sStyle : "background-color:rgba(255,255,255,1); color:#252525; border:none; border-radius: 5px;",
            scrollbar: false,
            time: T || 2,
            shadeClose: false,
            end: function() {
                if (fn) fn();
            }
        });
        NoTouchMove($(".laymshade"));
    }
    exports.TipLayerEnd = TipLayerEnd;
    // 用户手动关闭弹框
    function TipLayerLong(sCont, sStyle) {
        layer.open({
            content: sCont,
            style: sStyle != "no" ? sStyle : "background-color:rgba(255,255,255,1); color:#252525; border:none; border-radius: 5px;",
            scrollbar: false,
            shadeClose: true
        });
        NoTouchMove($(".laymshade"));
    }
    exports.TipLayerLong = TipLayerLong;
    // 用户手动关闭弹框有关闭按钮
    function TipLayerLongClose(sTit, sCont, sStyle, fn) {
        layer.open({
            title: sTit != "no" ? sTit : "",
            content: sCont,
            style: sStyle != "no" ? sStyle : "background-color:rgba(255,255,255,1); color:#252525; border:none; border-radius: 5px;",
            scrollbar: false,
            shadeClose: true,
            closeBtn: 1,
            success: function() {
                if (fn) fn();
            }
        });
        NoTouchMove($(".laymshade"));
    }
    exports.TipLayerLongClose = TipLayerLongClose;
    //带按钮提示框
    function TipBtnLayer(sCont, sTit, btnName, yesFn, cancelFn, fn) {
        layer.open({
            title: sTit != "no" ? sTit : "",
            content: sCont,
            btn: btnName == undefined ? [ "确定" ] : [ btnName ],
            shadeClose: false,
            scrollbar: false,
            yes: function() {
                if (yesFn) yesFn();
                LayerCloseAll();
            },
            cancel: function() {
                if (cancelFn) cancelFn();
            },
            success: function() {
                if (fn) fn();
                $(".layermbtn span").css({
                    width: "100%"
                });
            }
        });
        NoTouchMove($(".laymshade"));
    }
    exports.TipBtnLayer = TipBtnLayer;
    // 标题提示框
    function TipTitleLayer(sTitle, styleTit, sCont, fn) {
        layer.open({
            title: [ sTitle, "background-color:#fff; color:#666; font-weight:bold" ],
            content: sCont,
            shadeClose: false,
            scrollbar: false,
            style: styleTit,
            cancel: function() {
                if (fn) fn();
            }
        });
        NoTouchMove($(".laymshade"));
    }
    exports.TipTitleLayer = TipTitleLayer;
    //询问层
    function askLayer(sCont, yesFn, noFn, sTit, callBack, aBtnName) {
        layer.open({
            //no 为没有标题 sTit为设置标题
            title: sTit != "no" ? sTit : "",
            content: sCont,
            btn: aBtnName == undefined ? [ "确认", "取消" ] : aBtnName,
            shadeClose: false,
            scrollbar: false,
            yes: yesFn,
            no: noFn,
            cancel: noFn,
            success: function() {
                if (callBack) callBack();
            }
        });
        NoTouchMove($(".laymshade"));
    }
    exports.askLayer = askLayer;
    // 关闭所有弹框
    function LayerCloseAll() {
        layer.closeAll();
    }
    exports.LayerCloseAll = LayerCloseAll;
    //加载层
    function loadLayer(cont) {
        layer.open({
            type: 2,
            content: cont,
            shadeClose: false
        });
        NoTouchMove($(".laymshade"));
    }
    exports.loadLayer = loadLayer;
    //防止滑动
    function NoTouchMove(obj) {
        obj.on("touchmove", function() {
            return false;
        });
    }
    exports.NoTouchMove = NoTouchMove;
    /*************** 弹框效果 e***************/
    //节流控制
    function throttle(method, context, time) {
        time == undefined ? time = 200 : time = time;
        //console.log(time)
        clearTimeout(method.tId);
        method.tId = setTimeout(function() {
            method.call(context);
        }, time);
    }
    exports.throttle = throttle;
    //s20是代表20秒 h是指小时，如12小时则是：h12 d是天数，30天则：d30
    //写cookies setCookie("name","hayden",'s20');
    function setCookie(name, value, time) {
        var strsec;
        if (time == undefined) {
            var Days = 30;
            //默认30天有效期
            strsec = Days * 24 * 60 * 60 * 1e3;
        } else {
            strsec = getsec(time) * 1;
        }
        var exp = new Date();
        exp.setTime(exp.getTime() + strsec);
        document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString() + ";path=/";
    }
    exports.setCookie = setCookie;
    //读取cookies getCookie("name")
    function getCookie(name) {
        var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
        if (arr = document.cookie.match(reg)) {
            return unescape(arr[2]);
        } else {
            return null;
        }
    }
    exports.getCookie = getCookie;
    //删除cookies delCookie('name')
    function delCookie(name) {
        var exp = new Date();
        exp.setTime(exp.getTime() - 1);
        var cval = getCookie(name);
        if (cval != null) document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString() + ";path=/";
    }
    exports.delCookie = delCookie;
    //设置cookie时间
    function getsec(str) {
        var str1 = str.substring(1, str.length) * 1;
        var str2 = str.substring(0, 1);
        if (str2 == "s") {
            return str1 * 1e3;
        } else if (str2 == "h") {
            return str1 * 60 * 60 * 1e3;
        } else if (str2 == "d") {
            return str1 * 24 * 60 * 60 * 1e3;
        }
    }
    /* 验证码倒计时 */
    function CutTime(time, fn1, fn2) {
        var _AllTime = time;
        var _T = null;
        clearInterval(_T);
        _T = setInterval(function() {
            if (time <= 0) {
                clearInterval(_T);
                if (fn1) fn1(_AllTime);
            } else {
                time--;
                if (fn2) fn2(time);
            }
        }, 1e3);
    }
    exports.CutTime = CutTime;
    /*手机号码验证*/
    function checkMobile(obj, fn1, fn2, fn3) {
        var oIphone = obj.val();
        var reg = /^(1[1|2|3|4|5|6|7|8|9])[\d]{9}$/;
        //验证手机号码
        if (oIphone == "") {
            if (fn1) fn1();
        } else if (!reg.test(oIphone)) {
            if (fn2) fn2();
        } else {
            if (fn3) fn3();
        }
    }
    exports.checkMobile = checkMobile;
    /*密码验证*/
    function checkPassWord(obj, fn1, fn2, fn3) {
        var _val = obj.val();
        var reg = /^[a-zA-Z0-9]{6,20}$/;
        //6-20位数字和英文
        if (_val == "") {
            if (fn1) fn1();
        } else if (!reg.test(_val)) {
            if (fn2) fn2();
        } else {
            if (fn3) fn3();
        }
    }
    exports.checkPassWord = checkPassWord;
    /*用户名验证*/
    function checkUserName(obj, fn1, fn2, fn3) {
        var _userName = obj.val();
        var reg = /^[A-Za-z\u4e00-\u9fa5][A-Za-z0-9\u4e00-\u9fa5]{1,9}$/;
        //验证用户名
        if (_userName == "") {
            if (fn1) fn1();
        } else if (!reg.test(_userName)) {
            if (fn2) fn2();
        } else {
            if (fn3) fn3();
        }
    }
    exports.checkUserName = checkUserName;
    //图片预加载(window)
    function lazLoadingImgEcho(obj, fn) {
        echo.init({
            container: obj,
            offset: 300,
            throttle: 50,
            //设置图片延迟加载的时间 
            callback: function(element, op) {
                if (fn) fn(element, op);
                // console.log(element, 'has been', op + 'ed')
                var $el = $(element);
                var sUl = $el.attr("src");
                loadImageCheck(sUl, function() {
                    $el.addClass("fadeIn");
                    $el = null;
                });
            }
        });
    }
    exports.lazLoadingImgEcho = lazLoadingImgEcho;
    function lazLoadingImg(obj) {
        this.obj = obj;
    }
    //添加图片预加载
    lazLoadingImg.prototype.AddLazLoadingImg = function(obj, fn) {
        this.obj = echoChangeByCc.initNew({
            container: obj,
            unload: false,
            offset: 300,
            throttle: 80,
            //设置图片延迟加载的时间
            callback: function(element, op) {
                var $el = $(element);
                var sUl = $el.attr("src");
                loadImageCheck(sUl, function() {
                    $el.addClass("fadeIn");
                    $el = null;
                });
                if (fn) fn();
            }
        });
    };
    // 图片预加载 销毁
    lazLoadingImg.prototype.DestroyLazLoadingImg = function() {
        var _this = this.obj;
        if (_this && _this.detach) {
            _this.detach();
        }
    };
    // 图片预加载 刷新
    lazLoadingImg.prototype.RushLazLoadingImg = function() {
        var _this = this.obj;
        _this.render();
    };
    function loadImageCheck(url, callback) {
        //创建一个Image对象，实现图片的预下载
        var img = new Image();
        img.src = url;
        // 如果图片已经存在于浏览器缓存，直接调用回调函数
        if (img.complete) {
            callback();
            img = null;
            return;
        }
        img.onload = function() {
            //图片下载完毕时异步调用callback函数。
            callback();
            img = null;
        };
    }
    exports.lazLoadingImg = lazLoadingImg;
    function lazLoadingImgEchoAbs(obj, fn) {
        echoChangeByCc.initNew({
            container: obj,
            unload: false,
            offset: 200,
            throttle: 30,
            //设置图片延迟加载的时间
            callback: function(element, op) {
                var $el = $(element);
                // console.log($el)
                var sUl = $el.attr("src");
                loadImageCheck(sUl, function() {
                    $el.addClass("fadeIn");
                    $el = null;
                });
                if (fn) fn();
            }
        });
    }
    exports.lazLoadingImgEchoAbs = lazLoadingImgEchoAbs;
    //mui插件事件开关
    function OffMuiEvent(arg) {
        mui.init({
            gestureConfig: {
                tap: arg,
                //默认为true
                swipe: arg
            }
        });
    }
    exports.OffMuiEvent = OffMuiEvent;
    //设置li图片高度 父级获取
    function SetImgHeight(obj, getWidth) {
        var htmlFontSize = $("html").css("font-size");
        var intSize = htmlFontSize.split("p")[0];
        var imgWidth = null;
        if (obj[0].nodeName.toLowerCase() === "li") {
            getWidth ? imgWidth = getWidth / intSize : imgWidth = obj.find("figure").eq(0).parents("a").width() / intSize;
            // obj.find('figure:not(:first)').css({'height': imgWidth+'rem', 'width': imgWidth+'rem'});
            obj.find("figure").css({
                height: imgWidth + "rem",
                width: imgWidth + "rem"
            });
        } else {
            getWidth ? imgWidth = getWidth / intSize : imgWidth = obj.find("li figure").eq(0).parents("a").width() / intSize;
            // obj.find('li figure:not(:first)').css({'height': imgWidth+'rem', 'width': imgWidth+'rem'});
            obj.find("li figure").css({
                height: imgWidth + "rem",
                width: imgWidth + "rem"
            });
        }
    }
    exports.SetImgHeight = SetImgHeight;
    // 日期 2015-09-01 11:16:00
    function FormatDateTime(date, minType, point) {
        var y = date.getFullYear();
        var m = date.getMonth() + 1;
        m = m < 10 ? "0" + m : m;
        var d = date.getDate();
        d = d < 10 ? "0" + d : d;
        var h = date.getHours();
        h = h < 10 ? "0" + h : h;
        var minute = date.getMinutes();
        minute = minute < 10 ? "0" + minute : minute;
        var seconds = date.getSeconds();
        seconds = seconds < 10 ? "0" + seconds : seconds;
        var _sep = "-";
        if (point) _sep = point;
        // 最小到天
        if (minType == "minDay") {
            return y + _sep + m + _sep + d;
        } else if (minType == "minMinute") {
            return y + _sep + m + _sep + d + " " + h + ":" + minute;
        } else {
            return y + _sep + m + _sep + d + " " + h + ":" + minute + ":" + seconds;
        }
    }
    exports.FormatDateTime = FormatDateTime;
    /*************** 滚动条效果 s***************/
    function ScrollBar(obj) {
        this.obj = obj;
    }
    //添加滚动条
    ScrollBar.prototype.AddScroll = function(obj, sOptions) {
        this.obj = new JRoll(obj, sOptions);
    };
    //刷新滚动条
    ScrollBar.prototype.ReScroll = function(fn) {
        var _this = this.obj;
        _this.refresh();
        if (fn) fn();
    };
    //删除滚动条
    ScrollBar.prototype.DelScroll = function(fn) {
        var _this = this.obj;
        _this.destroy();
        if (fn) fn();
    };
    //滚动 到 0
    ScrollBar.prototype.ScrollTo = function(x, y, time, fn) {
        var _this = this.obj;
        _this.scrollTo(x, y, time, false, function() {
            if (fn) fn(_this);
        });
    };
    //滚动开始事件
    ScrollBar.prototype.ScrollStart = function(fn) {
        var _this = this.obj;
        _this.on("scrollStart", fn);
    };
    //滚动结束事件
    ScrollBar.prototype.ScrollEnd = function(fn1, fn2) {
        var _this = this.obj;
        _this.on("scrollEnd", fn1);
        if (fn2) fn2();
    };
    //滚动监听
    ScrollBar.prototype.ScrollIng = function(fn) {
        var _this = this.obj;
        //this.obj.on('scroll', fn);
        this.obj.on("scroll", function() {
            if (fn) fn(_this);
        });
    };
    //滚动下拉刷新
    ScrollBar.prototype.ScrollPullDown = function(sOptions) {
        var _this = this.obj;
        _this.pulldown(sOptions);
    };
    exports.ScrollBar = ScrollBar;
    function getFontSize() {
        var doc = document, win = window;
        var docEl = doc.documentElement, resizeEvt = "orientationchange" in window ? "orientationchange" : "resize", recalc = function() {
            var clientWidth = docEl.clientWidth;
            if (!clientWidth) return;
            //如果屏幕大于750（750是根据我效果图设置的，具体数值参考效果图），就设置clientWidth=750，防止font-size会超过100px
            if (clientWidth > 750) {
                clientWidth = 750;
            }
            //设置根元素font-size大小
            docEl.style.fontSize = 100 * (clientWidth / 750) + "px";
        };
        //屏幕大小改变，或者横竖屏切换时，触发函数
        win.addEventListener(resizeEvt, recalc, false);
        //文档加载完成时，触发函数
        // doc.addEventListener('DOMContentLoaded', recalc, false);
        $(doc).ready(function() {
            recalc();
        });
    }
    exports.getFontSize = getFontSize;
    function getGoodsNo(url) {
        var reg = new RegExp("^YW[a-zA-Z0-9]{12,14}$");
        var aUrl = "";
        if (!url) return;
        if (url.indexOf("/") > -1) {
            aUrl = url.substr(0).split("/");
            for (var i = 0; i < aUrl.length; i++) {
                if (checkField(aUrl[i])) {
                    return checkField(aUrl[i]);
                } else if (checkField(aUrl[i]) == undefined) {
                    return false;
                }
            }
        } else {
            if (checkField(url)) {
                return checkField(url);
            } else if (checkField(url) == undefined) {
                return false;
            }
        }
        function checkField(_url) {
            var _aUrl = "";
            if (_url.length >= 14) {
                if (_url.indexOf("?") > 0) {
                    _aUrl = _url.split("?");
                    for (var i = 0; i < _aUrl.length; i++) {
                        if (reg.test(_aUrl[i])) {
                            return _aUrl[i];
                        }
                    }
                } else {
                    if (reg.test(_url)) {
                        return _url;
                    } else {
                        return false;
                    }
                }
            } else {
                return false;
            }
        }
    }
    exports.getGoodsNo = getGoodsNo;
    // 检测 安卓 ios 分享 大当家 链接跳转
    function JudgeAppHref(obj, oldH5) {
        var _href = "";
        var _Num = 0;
        var u = navigator.userAgent;
        //var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
        var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
        //ios终端
        // 返回首页操作
        var hrefToHome = [ "/", "sf://" ];
        var hrefName = [ "/h/goodspay/goodsView/", "sf://goodsDetail?goodsSn=" ];
        var sLocationArg = window.location.search.split("?")[1];
        var fxBtn = false;
        if (sLocationArg !== undefined) {
            if (sLocationArg.search("sell_member_id") > -1) {
                fxBtn = true;
            }
        }
        // 检测室安卓还是ios
        if (u.search("origin/sfddjapp") > 0) {
            if (isIOS) {
                _Num = 1;
                obj.each(function(i) {
                    _href = obj.eq(i).attr("_href");
                    // 检测回到首页
                    if (_href === "home") {
                        obj.eq(i).attr("href", hrefToHome[_Num] + _href);
                    } else {
                        if (getGoodsNo(_href)) {
                            obj.eq(i).attr("href", hrefName[_Num] + getGoodsNo(_href));
                        } else {
                            obj.eq(i).attr("href", _href);
                        }
                    }
                });
            } else {
                obj.each(function(i) {
                    // 检测回到首页
                    _href = obj.eq(i).attr("_href");
                    if (_href === "home") {
                        AndroidReHome(obj.eq(i));
                    } else {
                        if (getGoodsNo(_href)) {
                            //要去掉a标签自带的href属性，因为这个跳转比点击事件要快，如果有这个属性在安卓上会跳转两次
                            obj.eq(i).removeAttr("href");
                            AndroidGoods(obj.eq(i), getGoodsNo(_href));
                        } else {
                            obj.eq(i).attr("href", _href);
                        }
                    }
                });
            }
        } else if (window.__wxjs_environment === "miniprogram") {
            obj.each(function(i) {
                // 如果有_href 这个自定义属性，_href 只有等于 home 或者 商品编号，就回到小程序页面；
                _href = obj.eq(i).attr("_href");
                if (_href) {
                    // 禁用掉 href
                    // obj.eq(i).attr("href", "javascript:void(0);");
                    obj.eq(i).removeAttr("href");
                    // 检测回到首页
                    if (_href === "home") {
                        minAppEven(obj.eq(i));
                    } else {
                        if (getGoodsNo(_href)) {
                            minAppEven(obj.eq(i), getGoodsNo(_href));
                        } else if (isDrawCouponLink(_href)) {
                            minAppEven(obj.eq(i), false, "/pages/home/drawCoupon/drawCoupon?ruleSign=" + isDrawCouponLink(_href));
                        } else {
                            obj.eq(i).attr("href", _href);
                        }
                    }
                }
            });
        } else if (fxBtn) {
            _Num = 0;
            obj.each(function(i) {
                _href = obj.eq(i).attr("_href");
                if (_href === "home") {
                    obj.eq(i).attr("href", hrefToHome[_Num] + _href);
                } else {
                    if (getGoodsNo(_href)) {
                        obj.eq(i).attr("href", hrefName[_Num] + getGoodsNo(_href) + "?" + sLocationArg);
                    } else {
                        obj.eq(i).attr("href", _href + "?" + sLocationArg);
                    }
                }
            });
        } else {
            _Num = 0;
            obj.each(function(i) {
                _href = obj.eq(i).attr("_href");
                var appendData = _href.indexOf("?") > -1 ? "?" + _href.split("?")[1] : "";
                if (_href === "home") {
                    obj.eq(i).attr("href", hrefToHome[_Num] + _href);
                } else {
                    if (getGoodsNo(_href)) {
                        if (oldH5 === "oldH5") {
                            obj.eq(i).attr("href", "/shop/goods/view/" + getGoodsNo(_href) + appendData);
                        } else {
                            obj.eq(i).attr("href", hrefName[_Num] + getGoodsNo(_href) + appendData);
                        }
                    } else {
                        obj.eq(i).attr("href", _href);
                    }
                }
            });
        }
    }
    exports.JudgeAppHref = JudgeAppHref;
    //判断是否是h5的领券页
    function isDrawCouponLink(url) {
        // var  reg = new RegExp("^YW[a-zA-Z0-9]{12,14}$");
        var ruleSignStr = "";
        if (!url) return false;
        if (url.indexOf("/coupon/drawCoupon") > -1) {
            ruleSignStr = url.split("ruleSign=")[1];
            if (ruleSignStr.indexOf("&") > -1) {
                var ruleSign = ruleSignStr.split("&")[0];
                return ruleSign;
            } else {
                return ruleSignStr;
            }
        } else {
            return false;
        }
    }
    exports.isDrawCouponLink = isDrawCouponLink;
    // 小程序事件处理
    function minAppEven(obj, arg, url) {
        obj.off("click");
        obj.on("click", function() {
            // console.log(arg)
            // 小程序物品详情
            if (arg) {
                wx.miniProgram.navigateTo({
                    url: "/pages/shopping/goodsDetail/goodsDetail?goodsSn=" + arg
                });
            } else if (url) {
                wx.miniProgram.navigateTo({
                    url: url
                });
            } else {
                wx.miniProgram.switchTab({
                    url: "/pages/home/home"
                });
            }
        });
    }
    // 安卓绑定点击事件
    function AndroidGoods(obj, arg) {
        obj.off("click");
        obj.on("click", function() {
            android.goodsDetail(arg);
        });
    }
    // 安卓绑定点击返回首页
    function AndroidReHome(obj) {
        obj.off("click");
        obj.on("click", function() {
            android.toMainAcivity();
        });
    }
    function removeArrayChildren(arr, val) {
        var index = arr.indexOf(val);
        if (index > -1) {
            arr.splice(index, 1);
        }
    }
    exports.removeArrayChildren = removeArrayChildren;
    // 弹框获取焦点后 页面高度调整
    function setFocusBodyScrollTop(timer, fn) {
        var cnt = 0;
        var oBody = $("body");
        timer = setInterval(function() {
            if (cnt < 3) {
                cnt++;
            } else {
                clearInterval(timer);
                timer = null;
                return;
            }
            oBody[0].scrollTop = oBody[0].scrollHeight;
            if (fn) fn();
        }, 300);
    }
    exports.setFocusBodyScrollTop = setFocusBodyScrollTop;
    function locationHref(href) {
        $("body").append($('<a href="' + href + '"><span id="locationHrefId"><span><a>'));
        $("#locationHrefId").click();
    }
    exports.locationHref = locationHref;
    // 检测 安卓 ios 隐藏指定对象
    function JudgeAppHide(ios, and, h5) {
        var u = navigator.userAgent;
        //var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
        var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
        //ios终端
        // 检测室安卓还是ios
        if (u.search("origin/sfddjapp") > 0) {
            if (isIOS) {
                if (ios) ios();
            } else {
                if (and) and();
            }
        } else {
            if (h5) h5();
        }
    }
    exports.JudgeAppHide = JudgeAppHide;
    function isIphoneXsMinX() {
        return /iphone/gi.test(navigator.userAgent) && screen.height == 812 && screen.width == 375;
    }
    exports.isIphoneXsMinX = isIphoneXsMinX;
    function isIphoneXRXSMax() {
        return /iphone/gi.test(navigator.userAgent) && screen.height == 896 && screen.width == 414;
    }
    exports.isIphoneXRXSMax = isIphoneXRXSMax;
    /**
     * 判断是否是微信浏览器
     * @returns {Boolean}
     */
    function isWeiXin() {
        var ua = window.navigator.userAgent.toLowerCase();
        if (ua.match(/MicroMessenger/i) == "micromessenger") {
            return true;
        } else {
            return false;
        }
    }
    exports.isWeiXin = isWeiXin;
    /**
     * 判断是否是支付宝浏览器
     * @returns {boolean}
     */
    function isAlipayClient() {
        var ua = window.navigator.userAgent.toLowerCase();
        if (ua.match(/AlipayClient/i) == "alipayclient") {
            return true;
        } else {
            return false;
        }
    }
    exports.isAlipayClient = isAlipayClient;
    /**
     * 判断是否是QQ内置浏览器
     * @returns {boolean}
     */
    function isQQClient() {
        var ua = window.navigator.userAgent.toLowerCase();
        if (ua.match(/QQ/i) == "qq") {
            return true;
        } else {
            return false;
        }
    }
    exports.isQQClient = isQQClient;
    //XSS 前端过滤
    function XssCheck(str, reg) {
        return str ? str.replace(reg || /[&<">'](?:(amp|lt|quot|gt|#39|nbsp|#\d+);)?/g, function(a, b) {
            if (b) {
                return a;
            } else {
                return {
                    "<": "&lt;",
                    "&": "&amp;",
                    '"': "&quot;",
                    ">": "&gt;",
                    "'": ""
                }[a];
            }
        }) : "";
    }
    exports.XssCheck = XssCheck;
    /*
    * 判断用户是否安装app,已安装就跳app,未安装就正常跳h5页面
    * 因可能有安卓跳A页面，ios跳B页面的情况，所以两种终端的url分开写
    * androidUrl, iosUrl是跳的指定页面  比如'https://m.sfddj.com/coupon/toCouponCenter'
    * 如果没有指定页面(首页)就不填写或者填写空'' 如isHasApp('','',function(){})或者isHasApp()
    * */
    function isHasApp(androidUrl, iosUrl, fn) {
        var u = navigator.userAgent;
        var isAndroid = u.indexOf("Android") > -1 || u.indexOf("Linux") > -1;
        //android终端或者uc浏览器
        var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
        //ios终端
        if (u.search("origin/sfddjapp") == -1) {
            if (isAndroid) {
                // 在安卓的终端
                var HrefUrl = "";
                if (androidUrl && androidUrl != undefined && androidUrl != "") {
                    HrefUrl = "ddjapp://cn.dankal.sf/webpage?url=" + androidUrl;
                } else {
                    HrefUrl = "ddjapp://cn.dankal.sf/android";
                }
                // window.location.href = HrefUrl;
                locationHref(HrefUrl);
                setTimeout(function() {
                    if (fn) fn();
                }, 2e3);
            } else if (isiOS) {
                // 在ios的终端
                var HrefUrl = "";
                if (iosUrl && iosUrl != undefined && iosUrl != "") {
                    HrefUrl = "ddjapk://weburl?url=" + iosUrl;
                } else {
                    HrefUrl = "ddjapk://cn.dankal.sf";
                }
                window.location.href = HrefUrl;
                setTimeout(function() {
                    if (fn) fn();
                }, 2e3);
            }
        } else {}
    }
    exports.isHasApp = isHasApp;
    // 获取链接中的指定参数
    function getSearchString(key) {
        var str = window.location.search;
        str = str.substring(1, str.length);
        // 获取URL中?之后的字符（去掉第一位的问号）
        // 以&分隔字符串，获得类似name=xiaoli这样的元素数组
        var arr = str.split("&");
        var obj = new Object();
        // 将每一个数组元素以=分隔并赋给obj对象
        for (var i = 0; i < arr.length; i++) {
            var tmp_arr = arr[i].split("=");
            obj[decodeURIComponent(tmp_arr[0])] = decodeURIComponent(tmp_arr[1]);
        }
        return obj[key];
    }
    exports.getSearchString = getSearchString;
    // 跳转支付宝小程序 根据链接后面的 startAliapp 参数跳转
    function gotoMiniAlipay() {
        var _this = this;
        var startAliapp = getSearchString("startAliapp");
        if (!startAliapp) return;
        if (isWeiXin()) return;
        G_JSON_POST("/m/a/jumpLink/1.0/getJumpLink", {
            jumpLinkId: startAliapp
        }, function(data) {
            var _data = data.data;
            var _ret = data.ret;
            if (_ret.code == "0") {
                if (!_data) return;
                var s = document.createElement("a");
                s.href = _data;
                s.click();
            }
        });
    }
    exports.gotoMiniAlipay = gotoMiniAlipay;
    /**
     * 立即下单统计购买数据上传
     * @param order_sn
     * @param callback
     */
    function uploadCollection(payUrl, one_order_sn, callback) {
        // 立即购买的接口才记录
        if (payUrl !== "/shop/payment/orderPay") {
            return callback && typeof callback == "function" && callback();
        }
        var collectData = "/m/o/order/track/1.0/collectData";
        var sign = "";
        var query = window.location.search;
        query = query && query.trim();
        if (query) {
            query = query && query.split("&").filter(function(item) {
                return item.indexOf("goodMk") !== -1;
            });
            if (query && query[0]) {
                // 获取到的标识：F9VAGD597K1IIW0L
                sign = query[0].replace("goodMk=", "");
            }
        }
        if (one_order_sn && sign) {
            G_JSON_POST(collectData, {
                orderSn: one_order_sn,
                sign: sign
            }, function() {
                callback && typeof callback == "function" && callback();
            }, function() {
                callback && typeof callback == "function" && callback();
            });
        } else {
            callback && typeof callback == "function" && callback();
        }
    }
    exports.uploadCollection = uploadCollection;
});
define("static_v4/js/mod/submit_pay", [ "./public" ], function(require, exports, module) {
    var myPub = require("./public");
    // var lpkPay = require('./submit_lpkPay');
    var $orderForm = $("#orderForm");
    // 需要支付的表单
    var $canBuy = $("#canBuy");
    // 判断是否可以购买积分商品
    var $isJifen = $("#isJifen");
    //判断是否是积分商品
    var $submitBtn = $(".js_btnPay");
    // 提交支付按钮
    var oFullGroup = $(".js_fullGroup");
    // 拼单已满提示弹窗
    var oCashMain = $(".js_cashMain");
    var oShadows = $(".js_shadowlpk");
    var kcuid = $("#kcuid").val();
    //为爱狂吃活动？？？
    var tempOrderSn;
    var tempOrderType;
    var tempPaymentId;
    //如果是积分商品且不满足购买条件，对提交按钮置灰且不可点击
    /*if($isJifen.val() && $canBuy.val() == 'false'){
        //将按钮置灰
        $submitBtn.find('button').removeClass('btn_Bgred').addClass('btn_Bggray');
    }*/
    function submitPay(payUrl, payData) {
        /*if($isJifen.val() && $canBuy.val() == 'false'){
            //积分商品不满足条件，按钮不可点击
            return;
        }*/
        G_JSON_POST(payUrl, payData, function(data) {
            tempOrderSn = data.one_order_sn;
            tempOrderType = data.order_type;
            tempPaymentId = data.payment_id;
            // 添加标识功能
            myPub.uploadCollection(payUrl, data.one_order_sn, function() {
                if ("PAYFINISH" == data.return_code) {
                    paySuccess();
                    return;
                }
                if ("SUCCESS" != data.return_code) {
                    if ("FULL_FAIL" == data.return_code) {
                        $("#groupBuyRecordId").val("");
                        oFullGroup.show();
                    } else {
                        myPub.TipLayer(data.return_msg);
                    }
                    if (data.resultObject != null) {
                        $('input[name="token"]').val(data.resultObject);
                    }
                    return;
                }
                if ("ALIPAY" == data.pay_type) {
                    if (submitAliPay) {
                        submitAliPay(data.return_from_text);
                    } else {
                        forbiddenPayType("ALIPAY");
                    }
                } else if ("WEIXIN" == data.pay_type) {
                    if (submitWeixinPay) {
                        submitWeixinPay(data.timeStamp, data.nonceStr, data.package, data.signType, data.paySign, paySuccess, payCancel, payFail);
                    } else {
                        forbiddenPayType("WEIXIN");
                    }
                } else if ("GLOBAL_ALIPAY" == data.pay_type) {
                    submitAliPay(data.return_from_text);
                } else if ("WEIXIN_HIPO" == data.pay_type) {
                    //商户号和币种  这里直接写死。后面调试完毕后，在统一后台返回参数
                    var sessionUid = myPub.getCookie("token");
                    window.location.href = "https://api.wisecashier.com/mp_pay/oauth?merchant_no=" + data.merchantNo + "&currency=" + data.currency + "&sessionUid=" + sessionUid + "&sysTradeNo=" + data.payment_order_sn;
                } else if ("QQQB" == data.pay_type) {
                    if (submitQQQBPay) {
                        submitQQQBPay(data.token_id, paySuccess, payCancel, payFail);
                    } else {
                        forbiddenPayType("QQQB");
                    }
                } else if ("WEIXIN_H5" == data.pay_type) {
                    if (submitWeixinH5) {
                        submitWeixinH5(data.mweb_url);
                    } else {
                        forbiddenPayType("WEIXIN_H5");
                    }
                } else if ("PREPAIDCARDCODE" == data.pay_type) {
                    ljkPay(data.totalFee, data.phone);
                } else if ("H5_ABCBANKPAY" == data.pay_type) {
                    if (submitABCBankPay) {
                        submitABCBankPay(data.return_from_text);
                    } else {
                        forbiddenPayType("H5_ABCBANKPAY");
                    }
                } else {
                    myPub.TipLayer("不存在的支付方式");
                }
            });
        });
    }
    exports.submitPay = submitPay;
    function paySuccess() {
        if (tempOrderType != null && (tempOrderType == "GIFT" || tempOrderType == "MULTIGIFT")) {
            myPub.locationHref("/shop/gift/sharePage/" + tempPaymentId);
            return;
        }
        var isGroupBuy = $orderForm.find('input[name="isGroupBuy"]').val();
        if ("yes" == isGroupBuy) {
            G_JSON_POST("/GroupBuying/getOrderInfo", "orderSn=" + tempOrderSn, function(data) {
                var recordId = data.recordId;
                if (typeof recordId != "undefined") {
                    // window.location.href = "/h/tuangou/groupOrderDetail/" + recordId;
                    myPub.locationHref("/h/tuangou/groupOrderDetail/" + recordId);
                }
            });
        } else {
            var _orderSn_kcuid = "";
            if (kcuid) {
                // window.location.href = "/member/order/tradeSuccess?orderSn=" + tempOrderSn+"&kcuid="+kcuid;
                _orderSn_kcuid = "?orderSn=" + tempOrderSn + "&payId=" + tempPaymentId + "&kcuid=" + kcuid;
            } else {
                _orderSn_kcuid = "?orderSn=" + tempOrderSn + "&payId=" + tempPaymentId;
            }
            // myPub.locationHref("/member/order/tradeSuccess" + _orderSn_kcuid);
            myPub.locationHref("/h/goodspay/paymentOver" + _orderSn_kcuid);
        }
    }
    function payFail() {
        // TipLayer(res.errMsg);
        localStorage.setItem("orderNav_index", 1);
        window.location.href = "/shop/pay/order_list";
    }
    function payCancel() {
        // TipLayer(res.errMsg);
        localStorage.setItem("orderNav_index", 1);
        window.location.href = "/shop/pay/order_list";
    }
    function forbiddenPayType(type) {
        myPub.TipLayerLong("暂不支持更换支付方式,请从订单下单渠道继续支付或重新下单");
    }
    function ljkPay(totalFee, phone) {
        $(".sxcashCardArea_sum").text("￥" + totalFee);
        $("#gfcUserPhone").val(phone);
        // $('#paymentId').val(paymentId)
        // $('#tempOrderSn').val(tempOrderSn);
        // $('#tempOrderType').val(tempOrderType);
        // lpkPay.ljkPsdShow();
        ljkPsdShow();
        myPub.HamstopPropaga();
    }
    function ljkPsdShow() {
        oCashMain.show().stop().animate({
            bottom: 0
        }, 300, function() {
            oShadows.show();
        });
        myPub.HamstopPropaga();
    }
});
define("static_v4/js/mod/baiduCount", [], function(require, exports, module) {
    var oBody = $("body");
    function getCookie(name) {
        var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
        if (arr = document.cookie.match(reg)) {
            return unescape(arr[2]);
        } else {
            return null;
        }
    }
    function JudgeSource(ios, and, wxmin, wx, alipay, qq, h5) {
        var u = window.navigator.userAgent;
        //var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
        var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
        //ios终端
        var isWXMini = window.__wxjs_environment == "miniprogram";
        var ua = u.toLowerCase();
        var isWeiXin = ua.match(/MicroMessenger/i) == "micromessenger";
        var isAlipay = ua.match(/AlipayClient/i) == "alipayclient";
        var isQQ = ua.match(/QQ/i) == "qq";
        // 检测室安卓还是ios
        if (u.search("origin/sfddjapp") > 0) {
            if (isIOS) {
                if (ios) ios();
            } else {
                if (and) and();
            }
        } else if (isWXMini) {
            if (wxmin) wxmin();
        } else {
            if (isWeiXin) {
                if (wx) wx();
            } else if (isAlipay) {
                if (alipay) alipay();
            } else if (isQQ) {
                if (qq) qq();
            } else {
                if (h5) h5();
            }
        }
    }
    // 第三方统计的插件
    var TPLMethods = {
        userInfo: JSON.parse(getCookie("ddj-userInfo")),
        // 百度统计
        baidu: function() {
            /**
             *  百度统计
             */
            var sfddjUrl = "9a6219852c6bc360b517de9714e19810";
            //m.sfddj.com
            (function() {
                var hm = document.createElement("script");
                hm.src = "//hm.baidu.com/hm.js?" + sfddjUrl;
                // var s = document.getElementsByTagName("script")[0];
                // s.parentNode.insertBefore(hm, s);
                oBody.append(hm);
            })();
        },
        // gio 统计
        gio: function() {
            var _this = this;
            !function(e, t, n, g, i) {
                e[i] = e[i] || function() {
                    (e[i].q = e[i].q || []).push(arguments);
                }, n = t.createElement("script");
                // tag = t.getElementsByTagName("script")[0];
                // n.async = 1;
                n.src = ("https:" == document.location.protocol ? "https://" : "http://") + g;
                // tag.parentNode.insertBefore(n, tag)
                oBody.append(n);
            }(window, document, "script", "assets.growingio.com/2.1/gio.js", "gio");
            var _gioSetUserId = "";
            if (_this.userInfo) {
                if (_this.userInfo.memberId) {
                    _gioSetUserId = _this.userInfo.memberId;
                } else if (_this.userInfo.openId) {
                    _gioSetUserId = _this.userInfo.openId;
                } else {
                    _gioSetUserId = "";
                }
            }
            gio("init", "b665fa1721dac33b", {});
            // console.log(ddjhoc.userAction)
            // console.log(gio)
            // 给gio 传递用户信息
            gio("setUserId", _gioSetUserId);
            gio("send");
        }
    };
    // ZaneMa Testing
    $.getScript("/static_v4/js/plug/DDJStatistics.js", function(response, status) {
        ddjhoc.init(function() {
            // TPLMethods.baidu();
            TPLMethods.gio();
        });
    });
});